node.js modify file data stream?
问题 I need to copy one large data file to another destination with some modifications. fs.readFile and fs.writeFile are very slow. I need to read line by line, modify and write to new file. I found something like this: fs.stat(sourceFile, function(err, stat){ var filesize = stat.size; var readStream = fs.createReadStream(sourceFile); // HERE I want do some modifications with bytes readStream.pipe(fs.createWriteStream(destFile)); }) But how to make modifications ? I tried to get data with data