Created
July 20, 2017 13:00
-
-
Save sandrooliveira/f4a171a66d6de01a8581b987e8eb4808 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
function readdirPromise(path){ | |
return new Promise((resolve,reject) => { | |
fs.readdir(path,(err,dirContent) =>{ | |
err ? reject(err) : resolve(dirContent) | |
}) | |
}) | |
} | |
async function listDir(path){ | |
const dirContent = await readdirPromise(path) | |
console.log(dirContent) | |
} | |
listDir('./'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho.