Created
April 26, 2016 20:53
-
-
Save maxdignan/9528e0c1245788984b0cdcfa794c49ea to your computer and use it in GitHub Desktop.
FileStreamingNode
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
var Iconv = require('Iconv').Iconv; | |
var fs = require('fs'); | |
var start = Date.now(); | |
function runner(i){ | |
rStream = fs.createReadStream('enwik8'); | |
var iconv = new Iconv('UTF-8', 'UTF-16LE'); | |
wStream = fs.createWriteStream('enwik16'); | |
return rStream.pipe(iconv).pipe(wStream); | |
} | |
for (var i = 0; i < 4; i++) { | |
var stream = runner(i); | |
if (i === 3) { | |
stream.on('finish', function() { | |
console.log((Date.now() - start) / 1000); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment