Buffer Reader for Node.JS is Open Source
- 2018-07-23
- Ginkgoch
In Node.js, when we want to read continuous number or string from a Buffer instance, we have to maintain a position where we are reading at. To make it easy, here is a library to help to read Buffer instance easier.

Install
1 | npm i ginkgoch-buffer-reader --save |
Test
1 | npm test |
Example
Prepare for data
1 | const buffer = Buffer.alloc(4); |
Without Ginkgoch Buffer Reader
1 | let i1 = buffer.readInt8(0); |
It is terrible to remember the length of the value type and manually accumulate the position; it is very easy to make mistake and hard to find out why. Even though we could create UT for our logic, but why not to make it easy and handle the headache to us?
With Ginkgoch Buffer Reader
It automatically manages the read position. You don’t need to manually calculate the position and type length anymore.
1 | const BufferReader = require('ginkgoch-buffer-reader'); |
API List
1 | constructor(buffer: Buffer); |
