Created
July 20, 2017 00:17
-
-
Save elyssonmr/35cef121a274bab4fee08c9214ba03ef to your computer and use it in GitHub Desktop.
Exercício 3
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, files) => { | |
if(err){ | |
reject(err) | |
}else{ | |
resolve(files) | |
} | |
}) | |
}) | |
} | |
const path = "./" | |
readdirPromise(path).then(files => console.log(files)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho