Created
April 5, 2016 12:44
-
-
Save shaikh-shahid/568a74efcb4c535a5022a7d265090c17 to your computer and use it in GitHub Desktop.
This file contains 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
"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