Skip to content

Instantly share code, notes, and snippets.

@tosipaulo
Created July 19, 2017 20:11
Show Gist options
  • Save tosipaulo/ac3e87c31533b3b600e2f6bcdc89e028 to your computer and use it in GitHub Desktop.
Save tosipaulo/ac3e87c31533b3b600e2f6bcdc89e028 to your computer and use it in GitHub Desktop.
Exercício 3
const fs = require('fs')
const path = "./"
const readdirPromise = (path) => {
return new Promise((resolve, reject) => {
fs.readdir(path, (err, files) => {
if(err){
reject(err)
}else{
resolve(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