CRC64 ECMA182
Implement of CRC64-ECMA182 for Node.js.
Installation
$ npm install --save crc64-ecma182
Usage
Calculate a Buffer
You can calculate the CRC64-ECMA182 value for a Node.js buffer or string:
crc64;
- Parameters:
buff
: the buffer or string to be calculated;
- Returns: the result buffer that calculated.
const crc64 = ;const ret1 = crc64;const ret2 = crc64;const ret3 = crc64;const ret4 = crc64; // ret1 ~ ret2 all equals to://// [ 0xfa, 0x39, 0x19, 0xdf, 0xbb, 0xc9, 0x5d, 0x99 ]
Calculate a file
You can calculate the CRC64-ECMA182 value for a file:
crc64;
- Parameters:
filename
: the file's name that to be calculated;toString
: to decide wether the result should be a buffer or a UInt64 string, default totrue
; (optional)callback
: the callback function which receives two argumentserr
andret
.
crc64;
Convert Result Buffer to String
If you get a CRC64-ECMA182 result in Buffer, you could convert it to a UInt64 string via function:
crc64;
- Parameters:
buff
: the CRC64-ECMA182 buffer result;
- Returns: the UInt64 string.
const ret1 = crc64;const str = crc64; // 11051210869376104954
Contribution
You're welcome to make pull-requests.