gartal
Read bytes, ints, strings and more from streams as promises
Last updated 6 years ago by sehrope .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install gartal 
SYNC missed versions from official npm registry.

gartal

NPM

Build Status

Overview

Read bytes, numbers and text from streams as Promises.

Combined with async/await, this makes it very easy to interact with binary protocols.

Install

$ npm install gartal --save

Usage

// Load the module
const gartal = require('gartal');

// Read 10 bytes
const buf = await gartal.readBytes(stream, 10);

// Read a 32-bit big endian integer
const num = await gartal.readInt32BE(stream);

// Read a fixed length string
const text = await gartal.readText(stream, 8);

// Read a UUID serialized as a 36-byte hex string with dashes
const uuid = await gartal.readTextUuid(stream);

// Read a UUID serialized as 16-bytes
const uuid = await gartal.readBinaryUuid(stream);

Dependencies

None!

Features

  • Natively promisified for easy async/await integration
  • Supports reading arbitrarily sized byte buffers
  • Supports reading fixed length text strings
  • Supports reading numeric types (integers, doubles, etc)

Building and Testing

To build the module run:

$ make

Then, to run the tests run:

$ make test

License

ISC. See the file LICENSE.

Current Tags

  • 2.0.0                                ...           latest (6 years ago)

5 Versions

  • 2.0.0                                ...           6 years ago
  • 1.1.2                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE