Skip to content

Instantly share code, notes, and snippets.

@glennblock
Created April 15, 2012 20:29
Show Gist options
  • Save glennblock/2394695 to your computer and use it in GitHub Desktop.
Save glennblock/2394695 to your computer and use it in GitHub Desktop.
async exits with streamline
//this does not work because exists does not accept a standard callback
function createRequiredFilesIfNotPresent(_) {
var baseFolder = process.cwd();
var exists = path.exists(baseFolder + "/server.js");
log.info(exists);
}
//using a wrapper function however works. Log entries added for sequence.
function exists(p, callback) {
path.exists(p, function(e) {
callback(null, e);
});
}
function createRequiredFilesIfNotPresent(_) {
var baseFolder = process.cwd();
log.info("check exists start");
var p1 = exists(baseFolder + "/server.js", _);
log.info("exists:" + p1);
log.info("check exists complete");
}
@bjouhier
Copy link

Sure. My skype is offline most of the time but I'll turn it on. But that won't be before tomorrow as I'm travelling today.

@bjouhier
Copy link

Forgot. my skype id is bjouhier

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