Skip to content

Instantly share code, notes, and snippets.

@bassemZohdy
Last active August 29, 2015 14:16
Show Gist options
  • Save bassemZohdy/e8169b6c34f2099b3b2b to your computer and use it in GitHub Desktop.
Save bassemZohdy/e8169b6c34f2099b3b2b to your computer and use it in GitHub Desktop.
'use strict';
var fs = require('fs');
var Lazy=require("lazy");
var fileName = '{fileName}';
var file = fs.createReadStream(fileName,{encoding:'utf-8'});
var NanoTimer = require('nanotimer');
var timer = new NanoTimer();
function loadFile(callback){
new Lazy(file).lines.forEach(
function(line){
}
).on('pipe', function() {
callback();
});
}
timer.time(loadFile, '', 'u', function(time){
console.log("It took " + time + " microseconds to read that file!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment