diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/crc/README.md | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/crc/README.md')
-rw-r--r-- | node_modules/crc/README.md | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/node_modules/crc/README.md b/node_modules/crc/README.md index ca501f60f..8625c19b4 100644 --- a/node_modules/crc/README.md +++ b/node_modules/crc/README.md @@ -1,34 +1,25 @@ # crc -[](https://www.gittip.com/alexgorbatchev/) -[](https://david-dm.org/alexgorbatchev/node-crc) -[](https://david-dm.org/alexgorbatchev/node-crc?type=dev) -[](https://travis-ci.org/alexgorbatchev/node-crc) - -[](https://npmjs.org/package/crc) - -Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser. - -# Important: Node >= 6.3.0 < 6.9.2 - -There's was a bug in Node [#9342](https://github.com/nodejs/node/issues/9342) that affected CRC calculation if `Buffer.split()` is used (see issue discussion for details). This affected all version starting from `6.3.0` up to but not including `6.9.2`. The patch [#9341](https://github.com/nodejs/node/pull/9341) was released in `6.9.2`. If you are upgrading and seeing odd CRC calculation mismatches, this might be the reason. +The module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser. ## Features -* Full test suite comparing values against reference `pycrc` implementation. -* Pure JavaScript implementation, no dependencies. -* Provides CRC tables for optimized calculations. -* Provides support for the following CRC algorithms: - * CRC1 `crc.crc1(…)` - * CRC8 `crc.crc8(…)` - * CRC8 1-Wire `crc.crc81wire(…)` - * CRC16 `crc.crc16(…)` - * CRC16 CCITT `crc.crc16ccitt(…)` - * CRC16 Modbus `crc.crc16modbus(…)` - * CRC16 Kermit `crc.crc16kermit(…)` - * CRC16 XModem `crc.crc16xmodem(…)` - * CRC24 `crc.crc24(…)` - * CRC32 `crc.crc32(…)` +- Full test suite comparing values against reference `pycrc` implementation. +- Pure JavaScript implementation, no dependencies. +- ES6 modules. +- Provides CRC tables for optimized calculations. +- Provides support for the following CRC algorithms: + - CRC1 (`crc1`) + - CRC8 (`crc8`) + - CRC8 1-Wire (`crc81wire`) + - CRC16 (`crc16`) + - CRC16 CCITT (`crc16ccitt`) + - CRC16 Modbus (`crc16modbus`) + - CRC16 Kermit (`crc16kermit`) + - CRC16 XModem (`crc16xmodem`) + - CRC24 (`crc24`) + - CRC32 (`crc32`) + - CRCJAM (`crcjam`) ## Installation @@ -38,26 +29,41 @@ npm install crc ## Usage -Calculate a CRC32: +Calculate a CRC32 (recommended way): ```js -var crc = require('crc'); +import crc32 from 'crc/crc32'; +crc32('hello').toString(16); +// "3610a686" +``` +Import everything (this may bloat bundle size): + +```js +import crc from 'crc'; crc.crc32('hello').toString(16); // "3610a686" ``` +Or use CommonJS (compatability mode, no longer recommended): + +```js +const { crc32 } = require('crc'); +crc32('hello').toString(16); +// "3610a686" +``` + Calculate a CRC32 of a file: ```js -crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16); +crc32(fs.readFileSync('README.md', 'utf8')).toString(16); // "127ad531" ``` Or using a `Buffer`: ```js -crc.crc32(fs.readFileSync('README.md')).toString(16); +crc32(fs.readFileSync('README.md', 'utf8')).toString(16); // "127ad531" ``` @@ -71,6 +77,10 @@ value.toString(16); // "9e1c092" ``` +# Important: Node >= 6.3.0 < 6.9.2 + +There's was a bug in Node [#9342](https://github.com/nodejs/node/issues/9342) that affected CRC calculation if `Buffer.split()` is used (see issue discussion for details). This affected all version starting from `6.3.0` up to but not including `6.9.2`. The patch [#9341](https://github.com/nodejs/node/pull/9341) was released in `6.9.2`. If you are upgrading and seeing odd CRC calculation mismatches, this might be the reason. + ## Running tests ``` |