Last active
August 29, 2015 14:16
-
-
Save bassemZohdy/e8169b6c34f2099b3b2b 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 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