Chunk Reader
Read chunks from AsyncIterator by delimiter and do some work async.
This module uses async generators. Currently this feature available in Node.js >= v10.
Install
npm install --save chunk-readeroryarn add chunk-reader
Usage
const createReader = const fsPromses = promisesconst fs = { const filePath = "./pathToFile" const delimiter = "\n" const size: bytesTotal = await fsPromses const stream = fs const reader = for { // do here some async stuff with cnunks console }}
createReader(asyncIterator, [opts]) ⇒ AsyncIterator
Create a new ChunkReader instance.
Param | Type | Description |
---|---|---|
[asyncIterator] | AsyncIterator |
|
[options] | Object |
|
[options.delimiter] | String |
Chunk delimiter (optional). EOL by default; |