Read (and write) file by chunks using pipe
- pipe
const fs = require('fs');
const readStream = fs.createReadStream('README', 'utf8'); // inherits from events
const writeStream = fs.createWriteStream('README.txt');
readStream.pipe(writeStream);
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
const fs = require('fs');
const readStream = fs.createReadStream('README', 'utf8'); // inherits from events
const writeStream = fs.createWriteStream('README.txt');
readStream.pipe(writeStream);