Module: lib/crc

CRC util module

Source:

Methods

(static) default(buf, crcVal) → {null|string}

Validate CRC of buf

Parameters:
Name Type Description
buf Buffer

Chunk type + data buffer

crcVal

chunk CRC val

Source:
Returns:
  • The error message or null
Type
null | string

(inner) crc(buf) → {number}

Return the CRC of the bytes buf[0..len-1].

Parameters:
Name Type Description
buf Buffer

The buffer used to calculate thr CRC

Source:
Returns:
  • sInt 32 the CRC value of buf
Type
number

(inner) updateCrc(crc, buf) → {number}

Update crc with buf content

Parameters:
Name Type Description
crc number

current crc

buf Buffer

data buffer

Source:
Returns:
  • updated crc
Type
number