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
npm i --save @dev-essentials/inflow
Asynchronous access (async/await):
constInflow=require('@dev-essentials/inflow');conststream=inflow.stdin();letline;while(line=awaitstream.nextAsync()){console.log(line);}Asynchronous access (without async/await):
constInflow=require('@dev-essentials/inflow');conststream=inflow.stdin();consthandler=line=>{if(!line)return;console.log(line);stream.nextAsync().then(handler);}stream.nextAsync().then(handler);Asynchronous access (callback):
constInflow=require('@dev-essentials/inflow');conststream=inflow.stdin({callback: line=>{console.log(line);},});