xxxxxxxxxx
const fs = require('fs');
const r = fs.createReadStream('file.txt');
const z = zlib.createGzip();
const w = fs.createWriteStream('file.txt.gz');
r.pipe(z).pipe(w);
xxxxxxxxxx
streams is process(read and write) data piece(chunks) without completing the
whole read or write operation, and therefore without keeping all the data in
memory.
There are four types of streams => readable streams, writable streams, duplex
and transform streams.