Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active August 29, 2015 14:23
Show Gist options
  • Save ajcrites/5a4b8d823d2b39d87079 to your computer and use it in GitHub Desktop.
Save ajcrites/5a4b8d823d2b39d87079 to your computer and use it in GitHub Desktop.
import {readFile} from "fs";
let file;
function isItAsync(file, cb) {
if (!file) {
return cb("no file");
}
readFile(file, cb);
}
function checkMe(err, contents) {
if (err) {
console.error(err);
}
else if (contents) {
console.log(contents);
process.exit(0);
}
isItAsync(file, checkMe);
}
checkMe();
file = __dirname + "/checkasync.js";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment