Skip to content

Instantly share code, notes, and snippets.

@bttmly
Created August 12, 2014 22:57
Show Gist options
  • Save bttmly/4aba241e0f2cd50242f7 to your computer and use it in GitHub Desktop.
Save bttmly/4aba241e0f2cd50242f7 to your computer and use it in GitHub Desktop.
promises...
var Promise = require("bluebird");
var fs = require("fs");
Promise.promisifyAll(fs);
// fs.readFileAsync("file.js", "utf8").then(...)
var readFileTree = function ( root ) {
var results = [];
return new Promise( function ( resolve, reject ) {
// do stuff
// do stuff
if (done) {
resolve( results )
} else {
repeat
}
})
}
readFileTree().then( function (results) {
//
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment