@push-stream-std/push-concat (0.0.4)
Published 2026-07-19 23:31:24 +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-concat@0.0.4"@push-stream-std/push-concat": "0.0.4"About this package
push-concat
Concatenate stream into single value.
Published as @push-stream-std/push-concat.
Synopsis
import concat from '@push-stream-std/push-concat';
const sink = concat((err, result) => {
if (err) return console.error(err);
console.log(result); // 'hello world'
});
source.pipe(sink);
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-concat
Description
A sink that accumulates all stream values and invokes a callback with the concatenated result on end. String values are joined; Uint8Array and ArrayBuffer values are concatenated into a single Uint8Array; arrays and objects are collected into a plain array. An optional maxSize option enforces a total size limit, aborting early with a MAX_SIZE_EXCEEDED error.
API
concat(callback, options)
Creates a concat sink.
- callback
(err, result) => void– Called when the stream ends. On success,errisnullandresultis the concatenated value. On error or abort,erris set andresultisnull. - options
object(optional):- maxSize
number(defaultInfinity) – Maximum combined byte length for string/buffer data. Exceeding this triggers an error with code'MAX_SIZE_EXCEEDED'.
- maxSize
- Returns A sink object with
write(),end(),abort(),paused(alwaysfalse), andended.
Tests
npm test
Tests cover string concatenation, Uint8Array concatenation, empty stream returning empty string, error propagation on end(err), abort handling, preserving arrays of arbitrary objects, and the maxSize limit triggering MAX_SIZE_EXCEEDED.
Requirements
Node.js 18 or later. ESM only.
License
MIT
Keywords
push-stream
stream
concat
buffer
accumulate