stream-combiner
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
duplexer | 0.0.4 | 2.28 kB | MIT | prod |
Stream-combiner is a powerful JavaScript tool that serves the main function of turning a pipeline of Node.js streams into a single comprehensive stream. It works by writing to the first stream and reading from the last one. Notably, an 'error' listener in this stream will receive errors from all the connected streams inside the pipeline, enhancing error management throughout the streaming process.
Stream-combiner is a user-friendly Node.js tool that is easy to implement in your code. First, you need to install the package by running npm install --save stream-combiner
. Below is a basic example of using stream-combiner:
var Combine = require('stream-combiner') // Importing the package
var es = require('event-stream') // Additional required package
// Connecting streams together with pipe
Combine(
process.openStdin(), // Open stdin as the first stream
es.split(), // Split the stream to break on newlines
es.map(function (data, callback) { // Turn the asynchronous function into a stream
var repr = util.inspect(JSON.parse(data)) // Process the stream data
callback(null, repr) // Invoke the callback
}),
process.stdout // Output the processed stream to stdout
)
Stream-combiner can also be called with an array of streams, which allows for multiple stream manipulations to occur in one pipe:
var combinedStream = Combine([
stream1,
stream2
])
The official documentation for Stream-combiner can be accessed from the package's GitHub page - https://github.com/dominictarr/stream-combiner. Here, you'll find comprehensive usage guidelines, as well as links to related resources that can help enhance your understanding and use of the tool. It's important to go through these documents to fully leverage the capabilities of Steam-combiner in your Node.js projects.