Back to Explore

sindresorhus/merge-streams

GitHub
1 watchersOpen source

Last release: 5/4/2024

merge-streams is a Node.js utility that merges multiple readable streams into one unified readable stream, emitting data as each input stream provides it. It is useful when you need to combine the outputs of several streams and optionally add or remove streams dynamically.

Project status

  • The repository appears actively maintained, with a recorded upstream push on 2024-10-28, though the last published version update in the provided history is v4.0.0 dated 2024-05-04.
  • Update cadence from the provided tags shows multiple breaking changes in early 2024 (v2.3.0 on 2024-02-19, v3.0.0 on 2024-02-20, then v4.0.0 on 2024-05-04), with no further versioned updates shown after v4.0.0.

AI summary generated Today

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v4.0.0

    5/4/2024

    Release v4.0.0 primarily raises the minimum supported Node.js version to Node 18.18. The code changes are small, but there is an important behavioral adjustment around the default stream buffering when merging an empty list of streams.

    Breaking
  • v3.0.0

    2/20/2024

    v3.0.0 changes the stream merge behavior around removal, unpiping, and the empty-input case. The most visible API change is that `MergedStream.remove()` is now asynchronous, and the merge stream no longer auto-ends when `mergeStreams([])` is called.

    Breaking
  • v2.3.0

    2/19/2024

    v2.3.0 updates merge-streams stream lifecycle management, including cleanup and end/abort handling across multiple input streams. It also changes `MergedStream.remove()` behavior to be idempotent and adjusts internal abort tracking so that ending and destroying the merged stream interacts correctly with input streams.

    BreakingFeatures
  • v2.2.1

    2/14/2024

    Release v2.2.1 is described as a Node.js compatibility fix for Node versions >=18.0.0 <18.17.0. The code changes are minimal (2 files), but one change alters internal stream buffering behavior when there are zero input streams.

  • v2.2.0

    2/12/2024

    v2.2.0 adds the ability to add and remove input streams after calling `mergeStreams()`, via a new `MergedStream` class. The implementation refactors the merge logic into this class and changes the TypeScript surface area to expose `MergedStream`.

    Features
  • v2.1.0

    2/3/2024

    Release v2.1.0 focuses on improving cleanup of internal listeners and fixing incorrect behavior when callers use stream.unpipe(). Internally, the implementation was refactored to use abortable event handling to prevent hangs and to ensure listeners are removed when the merged stream or inputs stop.

  • v2.0.3

    1/30/2024

    v2.0.3 is a small internal change focused on how `mergeStreams` handles Node.js `maxListeners` warnings. The implementation and tests were updated to avoid triggering warnings when many streams are merged.

  • v2.0.2

    1/29/2024

    v2.0.2 updates merge-streams to address stream buffering behavior. The change removes an explicit resume call on the internal pass-through stream and adds a test that asserts the merged output buffers data (and stays non-flowing) before it is consumed.

  • v2.0.1

    1/23/2024

    v2.0.1 is described as a fix for streams getting stuck (PR #6). The diff shows additional stream buffering and backpressure behavior changes beyond a simple stuck-stream resolution.

  • v2.0.0

    1/22/2024

    v2.0.0 updates merge-streams to determine `objectMode` and `highWaterMark` based on the actual input streams, instead of forcing object mode and default buffering. It also refactors stream termination, switching to `stream/promises.finished()` to decide when to end or destroy the merged stream.

    Breaking