Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Created February 27, 2016 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MylesBorins/dc913f250a5556353eb5 to your computer and use it in GitHub Desktop.
Save MylesBorins/dc913f250a5556353eb5 to your computer and use it in GitHub Desktop.
async
var fs = require('fs');
function readSomething(path, cb) {
if (typeof path !== 'string') {
return process.nextTick(function () {
return cb('I should be second');
});
}
fs.readFile(path, cb);
}
readSomething({}, function (err, data) {
if (err) {
return console.log(err);
}
});
console.log('I should be first')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment