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
  • StreamWorker

    StreamWorker class - intended for internal use

    This class provides control over the subprocesses, including:

    • spawning
    • communicating
    • delivering streams

    Kind: global class
    Internal:

    new StreamWorker()

    Private constructor

    streamWorker.spawn() : StreamWorker ⇄

    Spawns the worker if necessary and provides the port information to it.

    Kind: instance method of StreamWorker

    streamWorker.delegate(input, delegateFunc, [plugins]) : DataStream

    Delegates a stream to the child using tcp socket.

    The stream gets serialized using JSON and passed on to the sub-process. The sub-process then performs transforms on the stream and pushes them back to the main process. The stream gets deserialized and outputted to the returned DataStream.

    Kind: instance method of StreamWorker
    Returns: DataStream - stream after transforms and back to the main process.

    Param Type Default Description
    input DataStream stream to be delegated
    delegateFunc Array.<DataStream~TeeCallback> | Array Array of transforms or arrays describing ['module', 'method']
    [plugins] Array [] List of plugins to load in the child

    StreamWorker:fork([count]) : Array.

    Spawns (Preforks) a given number of subprocesses and returns the worker asynchronously.

    Kind: static method of StreamWorker
    Returns: Array.<StreamWorker> - list of StreamWorkers

    Param Type Default Description
    [count] Number os.cpus().length Number of processes to spawn. If other subprocesses are active only the missing ones will be spawned.

    StreamWorker:_getWorker() : StreamWorker ⇄

    Picks next worker (not necessarily free one!)

    Kind: static method of StreamWorker