const rs = fs.createReadStream('./stream.js'); const ts = new Transform({ transform(chunk, encoding, callback) { callback(null, chunk.toString().toUpperCase()) } }); const ws = fs.createWriteStream('./stream_cap.js'); pipeline(rs, ts, ws, (err) => { if (err) { console.error(err); return; } console.log('Stream is done reading'); }); rs.resume();