Created
April 15, 2011 04:04
-
-
Save shinout/921121 to your computer and use it in GitHub Desktop.
fs.createWriteStream with large data
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 fs = require('fs'); | |
var stream = fs.createWriteStream(__dirname + '/out.txt'); | |
var str = 'hogehogefugafugafoobarpiyo['; | |
for ( var i=0; i < 1000000000; i++) { // 1Gtimes | |
stream.write(str + i + ']\n'); | |
} | |
stream.on('drain', function() { | |
console.log('drain'); // never happen | |
}); |
koichik
commented
Apr 15, 2011
I totally forgot the fact that node.js is a single thread model...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment