@kronoslive/crc16
Native node addon to calculate CRC16 values.
Last updated 7 months ago by kronoslive .
APACHE-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @kronoslive/crc16 
SYNC missed versions from official npm registry.

CRC16

Downloads npm version node version dependencies dev dependencies Follow on Twitter

Native node addon to calculate CRC16 values.

Installation

npm i crc16 --save

NOTE

If your intention is to use this to calculate redis slots then please use https://github.com/Salakar/cluster-key-slot - it's a pure JS implementation I wrote that is much faster than doing it natively.

Usage

CRC16(stringOrBuffer, [optional] encoding)
  • stringOrBuffer: String or a buffer. If a string is provided it will automatically be converted to a buffer.
  • encoding: Used for string to buffer conversion - only when a string is provided in stringOrBuffer
var CRC16 = require('crc16');
console.log(CRC16('some_value'));
console.log(CRC16('0d0103588990501766460026', 'hex'));

// calculate a redis hash slot
console.log(CRC16('key') & 16383);

License

APACHE-2.0

Current Tags

  • 1.0.1                                ...           latest (7 months ago)

1 Versions

  • 1.0.1                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |