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

Master Build StatusMaster Build StatusDependenciesDev DependenciesKnown VulnerabilitiesDeepScan grade
Classes
  • ~ShiftBufferCallback : function

    Shift Function

    Kind: inner typedef

    Param Type Description
    shifted Buffer shifted bytes

    ~ParseCallback : Promise

    Kind: inner typedef
    Returns: Promise - the promise should be resolved with the parsed object

    Param Type Description
    chunk Buffer the transformed chunk

    ~MapCallback : Promise | *

    Kind: inner typedef
    Returns: Promise | * - the mapped object

    Param Type Description
    chunk * the chunk to be mapped

    ~FilterCallback : Promise. | Boolean

    Kind: inner typedef
    Returns: Promise.<Boolean> | Boolean - information if the object should remain in the filtered stream.

    Param Type Description
    chunk * the chunk to be filtered or not

    ~ReduceCallback : Promise | *

    Kind: inner typedef
    Returns: Promise | * - accumulator for the next pass

    Param Type Description
    accumulator * the accumulator - the object initially passed or returned by the previous reduce operation
    chunk Object the stream chunk.

    ~DoCallback : function ⇄

    Kind: inner typedef

    Param Type Description
    chunk Object source stream chunk

    ~IntoCallback : * ⇄

    Kind: inner typedef
    Returns: * - resolution for the old stream (for flow control only)

    Param Type Description
    into * stream passed to the into method
    chunk Object source stream chunk

    ~UseCallback : DataStream ⇄

    Kind: inner typedef

    Param Type
    stream DataStream
    ...parameters any

    ~TeeCallback : function

    Kind: inner typedef

    Param Type Description
    teed DataStream The teed stream

    ~ScramjetTransformCallback : * | undefined

    Transform async callback. The passed transform should return a new chunk, unless the output should be filtered - if so, the transform should return undefined.

    Additionally the function can reject with DataStream.filter - the result will be filtered and no other transforms will be run on the chunk.

    Kind: inner typedef
    Returns: * | undefined - the result, undefined will be treated as filtered out.

    Param Type Description
    chunk Buffer | String | * the stream chunk
    encoding String encoding of the chunk

    ~ScramjetWriteCallback : function

    Write async callback. Await your async write and resolve.

    Kind: inner typedef

    Param Type Description
    chunk Buffer | String | * the stream chunk
    encoding String encoding of the chunk

    ~ScramjetReadCallback : Array.<*>

    Read async callback. Simply await your async operations and return the result as array.

    Kind: inner typedef
    Returns: Array.<*> - the read chunk.

    Param Type Description
    count Number the number of chunks that should be read ("this is more like a set of guideline than actual rules").

    ~DataStreamOptions : Object

    Standard options for scramjet streams.

    Defines async transforms or read/write methods for a stream.

    Kind: inner typedef
    Properties

    Name Type Default Description
    [promiseRead] ScramjetReadCallback an async function returning the next read item
    [promiseWrite] ScramjetWriteCallback an async function writing the next written item
    [promiseTransform] ScramjetTransformCallback an async function returning a transformed chunk
    [promiseFlush] ScramjetReadCallback an async function run before transform stream ends to push last chunks from the buffer
    [beforeTransform] ScramjetTransformCallback an async function run before the transform
    [afterTransform] ScramjetTransformCallback an async function run after the transform
    [maxParallel] Number os.cpus.length*2 the number of transforms done in parallel
    [referrer] DataStream a referring stream to point to (if possible the transforms will be pushed to it
    [objectMode] boolean true should the object mode be used instead of creating a new stream)

    ~ShiftCallback : function

    Shift Function

    Kind: inner typedef

    Param Type Description
    shifted Array.<Object> an array of shifted chunks

    ~AccumulateCallback : Promise | *

    Kind: inner typedef
    Returns: Promise | * - resolved when all operations are completed

    Param Type Description
    accumulator * Accumulator passed to accumulate function
    chunk * the stream chunk

    ~ConsumeCallback : Promise | *

    Kind: inner typedef
    Returns: Promise | * - resolved when all operations are completed

    Param Type Description
    chunk * the stream chunk

    ~RemapCallback : Promise | *

    Kind: inner typedef
    Returns: Promise | * - promise to be resolved when chunk has been processed

    Param Type Description
    emit function a method to emit objects in the remapped stream
    chunk * the chunk from the original stream

    ~FlatMapCallback : Promise. | Iterable

    Kind: inner typedef
    Returns: Promise.<Iterable> | Iterable - promise to be resolved when chunk has been processed

    Param Type Description
    chunk * the chunk from the original stream

    ~JoinCallback : Promise.<*> | *

    Kind: inner typedef
    Returns: Promise.<*> | * - promise that is resolved with the joining item

    Param Type Description
    previous * the chunk before
    next * the chunk after

    ~AffinityCallback : Symbol | String

    Kind: inner typedef

    Param Type
    chunk *

    ~RateOptions

    Kind: inner typedef

    Param Type Default Description
    [timeFrame] Number 1000 The size of the window to look for streams.
    [getTime] function Date.now Time source - anything that returns time.
    [setTimeout] function setTimeout Timing function that works identically to setTimeout.

    ~ExecDataOptions : StringStream.ExecOptions

    Kind: inner typedef
    Extends: StringStream.ExecOptions
    Properties

    Name Type Description
    [parse] UseCallback scramjet module to transform the stream to string or buffer stream
    [stringify] UseCallback scramjet module to transform from string or buffer stream to wanted version

    ~CreateModuleOptions

    Options for createModule

    Kind: inner typedef
    Properties

    Name Type Description
    StreamClass DataStream defines what class should the module assume

    ~ScramjetErrors

    Kind: inner typedef
    Properties

    Name Type Description
    StreamError function stream error class

    ~StreamMixin : Object

    Definition of a single mixin for a specific Scramjet class. Should contain any number of stream methods.

    Kind: inner typedef
    Properties

    Name Type Description
    constructor function optional constructor that will be called in the stream constructor (this has to be an own property!)

    ~ScramjetPlugin : Object

    Definition of a plugin in Scramjet

    Kind: inner typedef
    Internal:
    Properties

    Name Type Description
    BufferStream StreamMixin definition of constructor and properties for the BufferStream prototype.
    DataStream StreamMixin definition of constructor and properties for the DataStream prototype.
    MultiStream StreamMixin definition of constructor and properties for the MultiStream prototype.
    StringStream StreamMixin definition of constructor and properties for the StringStream prototype.

    ~MultiMapCallback : DataStream ⇄

    Kind: inner typedef

    Param Type
    stream DataStream

    ~DistributeOptions

    Distribute options

    Kind: inner typedef
    Properties

    Name Type Default Description
    [plugins] Array [] a list of scramjet plugins to load (if omitted, will use just the ones in scramjet itself)
    [StreamClass] String DataStream the class to deserialize the stream to.
    [threads] Number os.cpus().length * 2 maximum threads to use - defaults to number of processor threads in os, but it may be sensible to go over this value if you'd intend to run synchronous code.
    [createOptions] DataStreamOptions {} maximum threads to use - defaults to number of processor threads in os, but it may be sensible to go over this value if you'd intend to run synchronous code.

    ~ValueOfCallback : Number

    Kind: inner typedef
    Returns: Number - value of the object

    Param Type Description
    chunk * stream object

    ~NumberStreamOptions : DataStreamOptions

    NumberStream options

    Kind: inner typedef
    Extends: DataStreamOptions
    Properties

    Name Type Default Description
    [valueOf] ValueOfCallback x => +x value of the data item function.

    ~ShiftStringCallback : function

    Kind: inner typedef

    Param Type Description
    shifted String Popped chars

    ~ParseCallback : Promise

    Kind: inner typedef
    Returns: Promise - the promise should be resolved with the parsed object

    Param Type Description
    chunk String the transformed chunk

    ~ExecOptions : child_process.SpawnOptions

    Kind: inner typedef
    Extends: child_process.SpawnOptions
    Properties

    Name Type Default Description
    [stream] number 1 (bitwise) the output stdio number to push out (defaults to stdout = 1)
    [interpreter] Array.<string> [] defaults to nothing, except on windows where "cmd.exe /c" will be spawned by default