@uttori/data-tools
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

view on npm npm module downloads Build Status Coverage Status Tree-Shaking Support Dependency Count Minified + GZip Minified

Uttori Data Tools

Tools for working with binary data.

  • CRC32 - Derive the Cyclic Redundancy Check of a data blob.
  • DataStream - Helpter class to ease parsing binary formats.
  • DataBuffer - Helper class for working with binary data.
  • DataBufferList - A linked list of DataBuffers.
  • DataBitstream - Read a DataStream as a stream of bits.

Install

npm install --save @uttori/data-tools

Examples

import { CRC32, DataBuffer, DataBufferList, DataBitstream, DataStream } from 'uttori-data-tools';

CRC32.of('The quick brown fox jumps over the lazy dog');
 '414FA339'

const stream_a = DataStream.fromData(Buffer.from([20, 29, 119]));
const stream_b = DataStream.fromData(Buffer.from([20, 29, 119]));
stream_a.compare(stream_b);
 true

const buffer = new DataBuffer(data);
const list = new DataBufferList();
list.append(buffer);

Tree Shaking with ESM Modules

To enable tree-shaking with RollUp, you will likely want to use replace() of @rollup/plugin-replace like the following example to get a clean output:

rollup({
  input: './you-entry-file.js',
  plugins: [
    replace({
      'process.env.UTTORI_DATA_DEBUG': 'false',
    }),
  ],
});

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test
DEBUG=Uttori* npm test

Contributors

License

Package Sidebar

Install

npm i @uttori/data-tools

Weekly Downloads

10

Version

3.0.0

License

MIT

Unpacked Size

969 kB

Total Files

33

Last publish

Collaborators

  • matthewcallis