Skip to content

A scramjet compatible readable stream that never ends

License

Notifications You must be signed in to change notification settings

scramjetorg/scramjet-fini

Repository files navigation

Scramjet Infinite Stream

A readable stream and a Scramjet plugin that never ends and always returns consequent id's.

Installation

npm install scramjet-fini

Usage as a plugin

You can use this module as a scramjet plugin - it will add a new method to all the streams: addId

    const scramjet = require('scramjet')
        .plugin(require("scramjet-fini"));

    fs.createReadStream("mydata.log")
        .pipe(new scramjet.StringStream())
        .split("\n")
        .parse(logParser)
        .addId((logline, id) => logline.id = id)

All the logs in the above example will have a sequential id.

Usage as Readable stream

    const {InfinteDataStream} = require("scramjet-infinite");

    new InfiniteDataStream()
        .pipe(myStream);

Oh... if you think of piping this to disk - this actually never ends and it will eventually use all your disk space.

About

A scramjet compatible readable stream that never ends

Resources

License

Stars

Watchers

Forks

Packages

No packages published