@push-stream-std/push-cat (0.0.7)
Installation
@push-stream-std:registry=https://hub.kl1.tenere.ai/api/packages/push-stream-std/npm/npm install @push-stream-std/push-cat@0.0.7"@push-stream-std/push-cat": "0.0.7"About this package
push-cat
Concatenate multiple push streams sequentially.
Published as @push-stream-std/push-cat.
Synopsis
import { cat } from '@push-stream-std/push-cat';
const source1 = /* push stream producing 1, 2, 3 */;
const source2 = /* push stream producing 4, 5, 6 */;
cat([source1, source2]).pipe(sink);
// Output: 1, 2, 3, 4, 5, 6
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-cat
Description
Creates a source stream that reads from multiple push streams in order, moving to the next source when the current one ends. Useful for chaining follow-up streams, e.g. a paginated API fetch. Aborting the combined stream aborts the current source and skips all remaining sources.
API
cat(sources)
Creates a concatenated source stream.
- sources
Array|...arguments– An array of push-stream sources, or passed as individual rest arguments. Null entries are skipped. - Returns A source stream with
pipe(),resume(),abort(),paused, andended. For an empty sources array, returns a stream that ends immediately.
cat.createEmptyCat()
Returns a source stream that immediately ends when piped. Used internally for the empty-sources case.
createEmptyCat()
Same as cat.createEmptyCat. Also exported as a named export.
Tests
npm test
Tests cover concatenating two and three sources, handling an empty sources array, accepting sources as rest arguments, and skipping null entries in the sources array.
Requirements
Node.js 18 or later. ESM only.
License
MIT
Dependencies
Dependencies
| ID | Version |
|---|---|
| @push-stream-std/push-stream-base | * |