Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crzidea/node-readbuf
Read buffer in a blazing fast way!
https://github.com/crzidea/node-readbuf
Last synced: 11 days ago
JSON representation
Read buffer in a blazing fast way!
- Host: GitHub
- URL: https://github.com/crzidea/node-readbuf
- Owner: crzidea
- Created: 2017-04-28T09:31:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-02T05:05:35.000Z (over 7 years ago)
- Last Synced: 2024-10-08T15:11:29.362Z (about 1 month ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-blazingly-fast - node-readbuf - Read buffer in a blazing fast way! (JavaScript)
README
# readbuf
[![Build Status](https://travis-ci.org/crzidea/node-readbuf.svg?branch=master)](https://travis-ci.org/crzidea/node-readbuf)
[![npm version](https://badge.fury.io/js/readbuf.svg)](https://badge.fury.io/js/readbuf)Read buffer in a blazing fast way! 7x faster than `Buffer`.
## Install
```js
npm install --save readbuf
```## Example
All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently.
```js
var readbuf = require('readbuf')
var buffer = new Buffer('abcdefghijklmnopqrstuvwxyz')var reader = readbuf(buffer)
reader.readUInt8(3)
reader.slice(3)
reader.slice(3).readUInt8(0)
```## Benchmark
```sh
node benchmark.js
```Results:
```
Buffer#slice() x 5,623,308 ops/sec ±4.29% (81 runs sampled)
BufferReader#slice() x 33,198,783 ops/sec ±2.02% (88 runs sampled)
Fastest is BufferReader#slice()
Buffer#slice().slice() x 3,360,206 ops/sec ±0.66% (89 runs sampled)
BufferReader#slice().slice() x 20,635,719 ops/sec ±2.21% (85 runs sampled)
Fastest is BufferReader#slice().slice()
Buffer#slice().slice().slice() x 2,275,712 ops/sec ±1.00% (87 runs sampled)
BufferReader#slice().slice().slice() x 15,011,949 ops/sec ±1.21% (89 runs sampled)
Fastest is BufferReader#slice().slice().slice()
```