Skip to content

Instantly share code, notes, and snippets.

@shaikh-shahid
Created April 5, 2016 12:44
Show Gist options
  • Save shaikh-shahid/568a74efcb4c535a5022a7d265090c17 to your computer and use it in GitHub Desktop.
Save shaikh-shahid/568a74efcb4c535a5022a7d265090c17 to your computer and use it in GitHub Desktop.
"use strict";
var fs = require('fs');
var co = require('co');
co(function* () {
var file1 = yield readFile('demo.js');
console.log(file1);
console.log("I am after file read even though its Async");
});
function readFile(filename) {
return function(callback) {
fs.readFile(filename, 'utf8', callback);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment