stream-combine

Merges time-based streams

Showing:

Popularity

Downloads/wk

125

GitHub Stars

2

Maintenance

Last Commit

2yrs ago

Contributors

4

Package

Dependencies

1

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

stream-combine

Merges chronological time-based streams.

Dependencies

The module requires no dependencies, except for running the tests.

Install

npm install stream-combine

Usage


Combine three time-serie streams, with common document key _id for unix time stamp.

async.map([
  "time-series-1"
  "time-series-2"
  "time-series-3"
], (serie, cb) => {
  db.collection(serie, (error, collection) => {
    if error return cb error
    
    stream = collection
      .find _id: $gt: 12
      .sort _id: 1
      .stream()
    
    cb(null, stream)
}, (error, streams) => {
  (new StreamCombine streams, "_id").pipe someCSVStream
})

Or in flowing mode, with example of output object structure:

(new StreamCombine streams, "_id").on("data", data => {
  console.log data
  // emits objects like
  // {
  //   indexes: [0, 2] 
  //   data:    [ { _id: 6, some-data-from-time-series-1 }, 
  //              { _id: 6, some-data-from-time-series-3 } ]
  // }
  // ...
})

where:

  • _id is the common time stamp of the next object in chronological order
  • indexes is the indexes of the streams that have the current time in common
  • data is the actual data of the common time step

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial