const fs = require('fs');
// Create a readable stream (reading from input.txt)
const readStream = fs.createReadStream('input.txt');
// Create a writable stream (writing to output.txt)
const writeStream = fs.createWriteStream('output.txt');
// Pipe the read stream into the write stream
readStream.pipe(writeStream);
console.log("Streaming data from input.txt to output.txt...");
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter