Skip to content

Instantly share code, notes, and snippets.

@othiym23
Last active December 12, 2015 08:19
Show Gist options
  • Save othiym23/4743530 to your computer and use it in GitHub Desktop.
Save othiym23/4743530 to your computer and use it in GitHub Desktop.
'use strict';
(function () {
var myfile;
function readFileCallback(err, val) {
if (err) throw err;
myfile=val;
console.log('in callback : ' + myfile);
}
function callbackMaker(callback) {
return function(err, vall) {
readFileCallback(err, val);
callback();
}
}
(require('fs')).readFile('betazoid.html',
callbackMaker(function () { console.log('post callback : ' + myfile); }));
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment