Stream Reader for Node.JS is Open Source
- 2018-07-28
- Ginkgoch
I/O APIs are very important. Node.js’ file stream API is very rough for reading file stream.
The fact is that, the API is hard to use, for example:
1 | var fs = require('fs'); |
The pain point is that, the data is read in an closure, you cannot read a chunk buffer with an expected length (even though you can use readable
), so it makes it difficult to code. I don’t like to have too many callbacks neither. So I created a stream reader to get rid of the callback hell.
Install
1 | npm i --save ginkgoch-stream-reader |
Usage
1 | const fs = require('fs'); |
See, we use async
function, no callbacks and we can read any length of buffer as we need to.