gartal
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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.

Package Sidebar

Install

npm i gartal

Weekly Downloads

2

Version

2.0.0

License

ISC

Unpacked Size

14 kB

Total Files

5

Last publish

Collaborators

  • sehrope