Skip to content

Instantly share code, notes, and snippets.

@jeyziel
Created July 20, 2017 17:20
Show Gist options
  • Save jeyziel/99692bbc35e678947f7fa977b55694ea to your computer and use it in GitHub Desktop.
Save jeyziel/99692bbc35e678947f7fa977b55694ea to your computer and use it in GitHub Desktop.
const fs = require('fs')
const path = './'
const readdirPromise = (path) => {
return new Promise( ( resolve, reject ) => {
fs.readdir( path, ( err, files) => {
if( err ) {
console.log('ocorreu um erro')
}else {
console.log(files)
}
})
})
}
readdirPromise(path).then((files)=> console.log(files))
@tuliofaria
Copy link

Certinho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment