CRC32C

CRC32C

new CRC32C(initialValue)

Constructs a new CRC32C object.

Reconstruction is recommended via the CRC32C.from static method.

Parameters:
Name Type Default Description
initialValue 0

An initial CRC32C value - a signed 32-bit integer.

Methods

toBuffer()

Returns a Buffer representation of the CRC32C value

toJSON()

Returns a JSON-compatible, base64-encoded representation of the CRC32C value.

See JSON#stringify

toString()

Returns a base64-encoded representation of the CRC32C value.

See Object#toString

update(data)

Calculates a CRC32C from a provided buffer.

Implementation inspired from:

Parameters:
Name Type Description
data

The Buffer to generate the CRC32C from

validate(input)

Validates a provided input to the current CRC32C value.

Parameters:
Name Type Description
input

A Buffer, CRC32C-compatible object, base64-encoded data (string), or signed 32-bit integer

valueOf()

Returns the number representation of the CRC32C value as a signed 32-bit integer

See Object#valueOf

(static) from(value)

Generates a CRC32C from a variety of compatable types. Note: strings are treated as input, not as file paths to read from.

Parameters:
Name Type Description
value

A number, 4-byte ArrayBufferView/Buffer/TypedArray, or 4-byte base64-encoded data (string)

(static) fromBuffer(value)

Generates a CRC32C from a compatible buffer format.

Parameters:
Name Type Description
value

4-byte ArrayBufferView/Buffer/TypedArray

(static) fromNumber(value)

Generates a CRC32C from a safe, unsigned 32-bit integer.

Parameters:
Name Type Description
value

an unsigned 32-bit integer

(static) fromString(value)

Generates a CRC32C from 4-byte base64-encoded data (string).

Parameters:
Name Type Description
value

4-byte base64-encoded data (string)