https://github.com/lostsource/buffer-read-await
asynchronously read data from incoming buffer stream
https://github.com/lostsource/buffer-read-await
Last synced: 2 months ago
JSON representation
asynchronously read data from incoming buffer stream
- Host: GitHub
- URL: https://github.com/lostsource/buffer-read-await
- Owner: lostsource
- License: mit
- Created: 2019-08-25T14:41:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-31T21:55:38.000Z (over 5 years ago)
- Last Synced: 2024-02-24T09:20:30.510Z (about 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# buffer-read-await
Asynchronously read data from incoming buffer stream## Installation
```
npm install buffer-read-await
```## Usage
### Create a reader```
const BufferReadAwait = require('buffer-read-await');
bfrReader = BufferReadAwait.alloc(1024);
```### Append data
```
bfrReader.append(buffer);
```
### Read data
Any of the standard NodeJS Buffer readers can be used. (readInt8, readUInt8, readInt16BE, readInt16LE, readUInt16BE, readUInt16LE, readInt32BE, readInt32LE, readUInt32BE, readUInt32LE, readBigInt64BE, readBigInt64LE, readBigUInt64BE, readBigUInt64LE)
```
let testbyte = await bfrReader.readUInt8();
```
The promise will resolve once enough data has been appended.