The through2 module provides a thin layer over the core stream's Transform constructor. It ultimately attaches the function we provide as the _transform method of a stream instance, which inherits from the Transform constructor.
When we create our upper stream, we call through and pass it a function. This is called the transform function. Each piece of data that the stream receives will be passed to this function. The first chunk is the data being received, the enc parameter indicates the encoding of the data, and the cb parameter is a callback function which we call to indicate we've finished processing the data, and pass our transformed data through.
There are a couple of benefits of using the through2 module over core primitives. Primarily, it's typically less noisy, easier for human reading, and uses the readable-stream module. The readable-stream module is the core stream module, but published to npm as the latest streams implementation. This keeps behavior consistent across Node versions; using through2 implicitly grants this advantage and we don't have to think about it.