Skip to content

Replacements for dev-null ​

stream.Writable (native, Node.js) ​

The native stream.Writable class can be used to construct a custom writable stream that discards incoming data.

ts
import devnull from 'dev-null'
import { Writable } from 'node:stream'

stream.pipe(devnull()) 

const empty = new Writable({ 
  write(chunk, encoding, callback) { 
    callback() 
  } 
}) 

stream.pipe(empty) 

Released under the MIT License. (13757e3d)