@dev-essentials/inflow

0.0.2 • Public • Published

inflow

Efficiently process text streams line-by-line

Inflow supports:

  • All character sets supported by node
  • Fast and efficient processing and buffering in the background
  • Blocking, non-blocking and asynchronous access

Installation

npm i --save @dev-essentials/inflow

Usage

Asynchronous access (async/await):

const Inflow = require('@dev-essentials/inflow');
const stream = inflow.stdin();

let line;
while (line = await stream.nextAsync()) {
    console.log(line);
}

Asynchronous access (without async/await):

const Inflow = require('@dev-essentials/inflow');
const stream = inflow.stdin();

const handler = line => {
    if (!line) return;
    console.log(line);
    stream.nextAsync().then(handler);
}

stream.nextAsync().then(handler);

Asynchronous access (callback):

const Inflow = require('@dev-essentials/inflow');
const stream = inflow.stdin({
    callback: line => {
        console.log(line);
    },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @dev-essentials/inflow

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

6.38 kB

Total Files

4

Last publish

Collaborators

  • nikxda
  • splittydev