push-stream-std

@push-stream-std/push-stream-to-stream (0.0.8)

Published 2026-07-20 21:48:36 +00:00 by Dvorak

Installation

@push-stream-std:registry=https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/
npm install @push-stream-std/push-stream-to-stream@0.0.8
"@push-stream-std/push-stream-to-stream": "0.0.8"

About this package

@push-stream-std/push-stream-to-stream

Convert push-streams to and from Node.js streams.

Published as @push-stream-std/push-stream-to-stream.

Synopsis

import { readable, writable, duplex } from '@push-stream-std/push-stream-to-stream';

const nodeReadable = readable(pushSource);
nodeReadable.on('data', (chunk) => console.log('got', chunk));
nodeReadable.on('end', () => console.log('done'));

const nodeWritable = writable(pushSink);
nodeSource.pipe(nodeWritable);

const nodeDuplex = duplex(pushDuplex);
nodeReadable2.pipe(nodeDuplex).pipe(nodeWritable2);

Install

npm config set @push-stream-std:registry https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/
npm config set -- //hub.kl1.tenere.ai/api/packages/push-stream-std/npm/:_authToken "$PACKAGE_TOKEN"
npm install @push-stream-std/push-stream-to-stream

Why

Bridges the gap between push-stream and Node.js's built-in Readable, Writable, and Duplex streams. readable adapts a push-stream source into a Node.js Readable in object mode. writable adapts a push-stream sink into a Node.js Writable. duplex adapts a push-stream duplex (with both source and sink properties) into a Node.js Duplex. All conversions use object mode with a default highWaterMark of 16 and propagate errors, abort, and end events bidirectionally.

API

readable(pushSource)

Converts a push-stream source to a Node.js Readable stream in object mode.

  • pushSource object – A push-stream source with pipe(), resume(), abort().
  • Returns stream.Readable – A Node.js readable stream. Backpressure is managed through the sink's paused getter/setter. If the source is already ended, the stream is ended or destroyed on the next tick.

writable(pushSink)

Converts a push-stream sink to a Node.js Writable stream in object mode.

  • pushSink object – A push-stream sink with write(), end(), abort().
  • Returns stream.Writable – A Node.js writable stream. On 'finish', the sink's end() is called. If the sink is already ended, the stream is destroyed on the next tick.

duplex(pushDuplex)

Converts a push-stream duplex to a Node.js Duplex stream in object mode.

  • pushDuplex object – A push-stream duplex with .source and .sink properties.
  • Returns stream.Duplex – A Node.js duplex stream. The readable side reads from pushDuplex.source; the writable side writes to pushDuplex.sink. Aborts and errors are propagated bidirectionally to both source and sink abort handlers.

Tests

npm test

Requirements

Node.js 22 or later. ESM only.

Keywords

push-stream stream adapter
Details
npm
2026-07-20 21:48:36 +00:00
0
SEE LICENSE IN LICENSE
3.8 KiB
Assets (1)
Versions (7) View all
0.0.9 2026-07-21
0.0.8 2026-07-20
0.0.7 2026-07-20
0.0.6 2026-07-20
0.0.5 2026-07-19