Skip to content

Instantly share code, notes, and snippets.

@diogomascarenha
Created July 19, 2017 20:51
Show Gist options
  • Select an option

  • Save diogomascarenha/3c550e793d157d0e3f4ee20f5863107e to your computer and use it in GitHub Desktop.

Select an option

Save diogomascarenha/3c550e793d157d0e3f4ee20f5863107e to your computer and use it in GitHub Desktop.
DevPleno - FullstackAcademy - Exercício 03
var fs = require('fs')
var Promise = require('promise')
const path = './'
function readdirPromise(path){
return new Promise(function(fulfill, reject){
fs.readdir(path, (err, files) => {
if(err){
reject(err)
}else{
fulfill(files)
}
})
})
}
readdirPromise(path).then(function(files){
console.log(files)
}).catch(function(err){
console.log(err)
})
@tuliofaria
Copy link

Certinho

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