Last active
August 29, 2015 14:23
-
-
Save ajcrites/5a4b8d823d2b39d87079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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