Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dev-essentials/inflow

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
    },
});

About

Efficiently process text streams line-by-line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.