$ npm install gartal
Read bytes, numbers and text from streams as Promises.
Combined with async/await, this makes it very easy to interact with binary protocols.
$ npm install gartal --save
// 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);
None!
To build the module run:
$ make
Then, to run the tests run:
$ make test
ISC. See the file LICENSE.
© 2010 - cnpmjs.org x YWFE | Home | YWFE