Alexandro.Net

Download README · GitHub release

@stackline/dev-null

Zero-dependency Node.js writable sink with exact dev-null compatibility and first-party types.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.3


Why this package?

A maintained, zero-dependency writable sink with the established dev-null@0.1.1 behavior.

This package is an independent, maintained continuation of dev-null. It preserves the callable Node.js Writable sink, its asynchronous write boundary, and option forwarding while adding native ESM entry points, first-party TypeScript declarations, and reproducible release checks.

Provenance

The upstream source and authorship history are documented in UPSTREAM_AUDIT.md and NOTICE. The Stackline fork is not affiliated with or endorsed by the original author.

Compatibility

Item Value
Package @stackline/dev-null@1.0.3
Node.js runtime >=12
CommonJS / primary entry ./index.js
ES module entry ./index.mjs
Type declarations ./index.d.ts

See COMPATIBILITY_CONTRACT.md and MIGRATION.md for the exact boundary and alias migration.

Installation

Install

npm install @stackline/dev-null

Preserve an existing require('dev-null') or import devNull from 'dev-null' without changing source code:

npm install dev-null@npm:@stackline/dev-null

Usage

CommonJS

const devNull = require('@stackline/dev-null');

source.pipe(devNull());

ESM

import devNull from '@stackline/dev-null';
import { pipeline } from 'node:stream/promises';

await pipeline(source, devNull());

Object mode and backpressure

import devNull from '@stackline/dev-null';

const sink = devNull({
  objectMode: true,
  highWaterMark: 16
});

sink.write({ id: 1 });
sink.end({ id: 2 });

All options are passed directly to Node's Writable constructor. Set objectMode: true before writing arbitrary JavaScript values.

Features and Integrations

When to use the native primitive

New code that does not need package compatibility can construct a sink directly:

import { Writable } from 'node:stream';

const sink = new Writable({
  write(_chunk, _encoding, callback) {
    callback();
  }
});

Use this package when a dependency already expects dev-null, when a shared factory keeps stream configuration consistent, or when first-party types and a tested Node-version contract are useful.

Security

Report vulnerabilities privately as described in SECURITY.md. Do not disclose an unpatched vulnerability in a public issue.

API Surface

API

devNull(options?)

Returns a Node.js Writable that accepts and discards every chunk. Calling the export with or without new is supported. _write completes asynchronously on the same timer boundary observed in dev-null@0.1.1, so standard backpressure, drain, finish, close, destroy, and error behavior remains owned by Node's stream implementation.

The package does not swallow upstream pipeline errors and does not convert invalid chunks. Byte mode rejects objects exactly as a normal Writable does.

Local Development

git clone https://github.com/alexandroit/stackline-dev-null.git
cd stackline-dev-null
npm ci
npm run verify

Release tooling uses Node.js 24.20.0 and npm 11.19.0. The consumer runtime contract remains the one documented above.

Consumer Smoke Test

Run the repository's existing consumer/package check after installing development dependencies:

npm run test:smoke

Release Checklist

Run npm run verify and inspect the package contents before release. Publish a new version through the GitHub Actions publishing workflow, using the SHA-512 digest of the reviewed tarball. Verify the exact published version, tarball integrity, and npm provenance after the run.

License

MIT. The original copyright and permission notice is preserved in LICENSE.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.