All Projects → feross → Multistream

feross / Multistream

Licence: mit
A stream that emits multiple other streams one after another (streams3)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Multistream

go-streams
Stream Collections for Go. Inspired in Java 8 Streams and .NET Linq
Stars: ✭ 127 (-46.41%)
Mutual labels:  stream, streams
wasm-streams
Bridging between web streams and Rust streams using WebAssembly
Stars: ✭ 61 (-74.26%)
Mutual labels:  stream, streams
streamplify
Java 8 combinatorics-related streams and other utilities
Stars: ✭ 40 (-83.12%)
Mutual labels:  stream, streams
web-streams-polyfill
Web Streams, based on the WHATWG spec reference implementation
Stars: ✭ 198 (-16.46%)
Mutual labels:  stream, streams
Remote Web Streams
Web streams that work across web workers and iframes.
Stars: ✭ 26 (-89.03%)
Mutual labels:  stream, streams
Stream Splicer
streaming pipeline with a mutable configuration
Stars: ✭ 52 (-78.06%)
Mutual labels:  stream, streams
godsend
A simple and eloquent workflow for streaming messages to micro-services.
Stars: ✭ 15 (-93.67%)
Mutual labels:  stream, streams
Sql Streams
Painless low level jdbc abstraction using the java 8 stream api.
Stars: ✭ 17 (-92.83%)
Mutual labels:  stream, streams
Chunk Store Stream
Convert an abstract-chunk-store compliant store into a readable or writable stream
Stars: ✭ 24 (-89.87%)
Mutual labels:  stream, streams
Labeled Stream Splicer
stream splicer with labels
Stars: ✭ 37 (-84.39%)
Mutual labels:  stream, streams
Cypher Stream
Neo4j Cypher queries as Node.js object streams
Stars: ✭ 58 (-75.53%)
Mutual labels:  stream, streams
Paguro
Generic, Null-safe, Immutable Collections and Functional Transformations for the JVM
Stars: ✭ 231 (-2.53%)
Mutual labels:  stream
Devalpha Node
A stream-based approach to algorithmic trading and backtesting in Node.js
Stars: ✭ 217 (-8.44%)
Mutual labels:  streams
Video Stream Merger
Merge multiple video MediaStreams into one composite.
Stars: ✭ 214 (-9.7%)
Mutual labels:  stream
Aioreactive
Async/await reactive tools for Python 3.9+
Stars: ✭ 215 (-9.28%)
Mutual labels:  streams
Azure Event Hubs
☁️ Cloud-scale telemetry ingestion from any stream of data with Azure Event Hubs
Stars: ✭ 233 (-1.69%)
Mutual labels:  stream
Zipson
JSON parse and stringify with compression
Stars: ✭ 229 (-3.38%)
Mutual labels:  stream
Core
The core functionality of OsmSharp.
Stars: ✭ 210 (-11.39%)
Mutual labels:  stream
Ixjava
Iterable Extensions for Java 6+
Stars: ✭ 210 (-11.39%)
Mutual labels:  stream
Byte Stream
A non-blocking stream abstraction for PHP based on Amp.
Stars: ✭ 208 (-12.24%)
Mutual labels:  stream

multistream travis npm downloads javascript style guide

A stream that emits multiple other streams one after another (streams3)

Sauce Test Status

cat

Simple, robust streams3 version of combined-stream. Allows you to combine multiple streams into a single stream. When the first stream ends, the next one starts, and so on, until all streams are consumed.

This module is used by WebTorrent, specifically create-torrent.

install

npm install multistream

usage

Use multistream like this:

var MultiStream = require('multistream')
var fs = require('fs')

var streams = [
  fs.createReadStream(__dirname + '/numbers/1.txt'),
  fs.createReadStream(__dirname + '/numbers/2.txt'),
  fs.createReadStream(__dirname + '/numbers/3.txt')
]

new MultiStream(streams).pipe(process.stdout) // => 123

You can also create an object-mode stream with MultiStream.obj(streams).

To lazily create the streams, wrap them in a function:

var streams = [
  fs.createReadStream(__dirname + '/numbers/1.txt'),
  function () { // will be executed when the stream is active
    return fs.createReadStream(__dirname + '/numbers/2.txt')
  },
  function () { // same
    return fs.createReadStream(__dirname + '/numbers/3.txt')
  }
]

new MultiStream(streams).pipe(process.stdout) // => 123

Alternatively, streams may be created by an asynchronous "factory" function:

var count = 0
function factory (cb) {
  if (count > 3) return cb(null, null)
  count++
  setTimeout(function () {
    cb(null, fs.createReadStream(__dirname + '/numbers/' + count + '.txt'))
  }, 100)
}

new MultiStream(factory).pipe(process.stdout) // => 123

contributors

license

MIT. Copyright (c) Feross Aboukhadijeh.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].