4 ms·
Why was the memory usage so high for the node/js version? Was the whole file being loaded into memory? Care to share the code?
by andyfleming 8y ago
Why was the memory usage so high for the node/js version? Was the whole file being loaded into memory? Care to share the code?
- cutler 8y agovar fs = require('fs'), byline = require('byline'); var stream = byline(fs.createReadStream('logs1.txt', {encoding: 'utf8'})); stream.on('data', function(line) { if (line.match(/\b\w{15}\b/)) console.log(line); });
- Can_Not 8y agoThat regex should have been declared a variable on its own line.