3.0.0 • Published 3 months ago

@uttori/data-tools v3.0.0

Weekly downloads
13
License
MIT
Repository
github
Last release
3 months ago

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

3.0.0

3 months ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago