Created
July 19, 2017 23:55
-
-
Save caioregatieri/aaa188eb7a3a43968e3c7585b80ae2a7 to your computer and use it in GitHub Desktop.
This file contains 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
function readdirPromise(path) { | |
const fs = require('fs') | |
return new Promise((resolve, reject) => { | |
fs.readdir(path, (err, files) => { | |
if (err) { | |
reject(err) | |
} else { | |
resolve(files) | |
} | |
}) | |
}) | |
} | |
readdirPromise('./').then((files) => console.log(files)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho