Replacements for through
stream.Writable (native, Node.js)
The native stream.Writable class can be used to create writable streams. It is a suitable replacement when through is being used only as a sink that consumes data, rather than as a duplex/transform stream that forwards data.
ts
import through from 'through'
import { Writable } from 'node:stream'
through(fn)
new Writable({
write: (chunk, encoding, callback) => {
fn(chunk)
callback()
}
})