July 2017
Intermediate to advanced
656 pages
16h 1m
English
In our index.js file, let's begin by requiring the dependencies we'll be using to create various streams:
const zlib = require('zlib') const map = require('tar-map-stream')
Let's imagine we want to take the gzipped tarball of the very first available version of Node, and change all the file paths in that tarball, as well as altering the uname (owner user) and mtime (modified time) fields of each file.
Now let's create some streams we'll be using to do that:
const decompress = zlib.createGunzip() const whoami = process.env.USER || process.env.USERNAME const convert = map((header) => { header.uname = whoami header.mtime = new Date() header.name = header.name.replace('node-v0.1.100', 'edon-v0.0.0') return header }) const ...