Skip to content

Replacements for through

stream.Writable (native, Node.js)

ts
import through from 'through'
import { Writable } from 'node:stream'

through(fn) 
new Writable({ 
  write: (chunk, encoding, callback) => { 
    fn(chunk) 
    callback() 
  } 
}) 

Released under the MIT License. (65e83b3b)