push-stream-std

@push-stream-std/push-concat (0.0.6)

Published 2026-07-20 21:36:02 +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.6
"@push-stream-std/push-concat": "0.0.6"

About this package

@push-stream-std/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

Why

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, err is null and result is the concatenated value. On error or abort, err is set and result is null.
  • options object (optional):
    • maxSize number (default Infinity) – Maximum combined byte length for string/buffer data. Exceeding this triggers an error with code 'MAX_SIZE_EXCEEDED'.
  • Returns A sink object with write(), end(), abort(), paused (always false), and ended.

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 22 or later. ESM only.

Keywords

push-stream stream concat buffer accumulate
Details
npm
2026-07-20 21:36:02 +00:00
0
SEE LICENSE IN LICENSE
3.5 KiB
Assets (1)
Versions (5) View all
0.0.7 2026-07-21
0.0.6 2026-07-20
0.0.5 2026-07-20
0.0.4 2026-07-19
0.0.3 2026-07-19