Fast, asynchronous, functional reactive stream programming framework with multi‑threading capability based on ES6+.

Master Build StatusMaster Build StatusDependenciesDev DependenciesKnown VulnerabilitiesDeepScan grade
Module exports
Classes
  • scramjet : Object

    Scramjet main exports expose all the stream classes and a number of methods.

    All scramjet streams allow writing, reading or transform modes - currently exclusively (meaning you can't have two at once). Any of the scramjet streams can be constructed with the following options passed to mimic node.js standard streams:

    • async promiseTransform(chunk) - transform method that resolves with a single output chunk
    • async promiseWrite(chunk) - write method that that resolves when chunk is written
    • async promiseRead(count) - read method that resolves with an array of chunks when called

    See node.js API for stream implementers for details

    The object exposes the following classes:

    • DataStream {@see DataStream} - the basic object stream of any type
    • StringStream {@see StringStream} - a stream of strings
    • BufferStream {@see BufferStream} - a stream of buffers
    • MultiStream {@see MultiStream} - a group of streams
    • NumberStream {@see NumberStream} - a stream of numbers
    • WindowStream {@see WindowStream} - a stream of windows of objects

    The general concept of Scramjet streams is facilitating node's TransformStream mechanism so that you don't need to create a number of streams and create the pipeline, but use the concept of chaining instead. When you call parse method for instance, scramjet creates a new stream, pipes it to the callee and forwards errors.

    What's worth mentioning - scramjet tries to limit the number of created transform streams and pushes the transforms one after another into the same stream class therefore a code stream.map(transform1).map(transform2).filter(transform3) will only operate on a single transform stream that evaluates all three transforms one after another.

    Extends: Object