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

Master Build StatusMaster Build StatusDependenciesDev DependenciesKnown VulnerabilitiesDeepScan grade
Module exports
  • Scramjet Modules

    A scramjet module is a simple node.js module that operates on a scramjet stream (derived from any DataStream).

    Here's how a minimal module looks like, let's save it as lib/my-mod.js:

    module.exports = function(stream, arg1, arg2) {
      return stream
        .map(x => ({value: x.value *+* arg1 + arg2}))

    And here's how to use it in, lets say main.js:

        .use('lib/my-mod', 10, 2);

    See the full usage at dataStream.use.

    Usage from CLI

    If you use CLI to modify your streams you can pass a set of modules in the command line, for instance we have a StringStream parsing module lib/parse-log.js:

    module.exports = function(stream) {
      return stream
        .parse(line => line.split(','))
        .map(([url, time, source]) => ({url, time, source}))

    and another doing some checking in lib/long-queries.js:

    module.exports = function(stream) {
      return stream
        .assign(async ({url, time}) => await fetchUrlStats(url, time))
        .filter(({percentile}) => percentile > 90)

    Now we're seeing a stream of long running queries on specific urls

    $ tailf /var/log/my.log | scramjet ./lib/parse-log ./lib/long-queries -d

    There's more to read at Scramjet CLI