Class CRC32C (6.12.0)

Package

@google-cloud/storage

Constructors

(constructor)(initialValue)

constructor(initialValue?: number);

Constructs a new CRC32C object.

Reconstruction is recommended via the CRC32C.from static method.

Parameter
NameDescription
initialValue number

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

Properties

CRC32C_EXTENSION_TABLE

static readonly CRC32C_EXTENSION_TABLE: Int32Array;

CRC32C_EXTENSIONS

static readonly CRC32C_EXTENSIONS: readonly [0, 4067132163, 3778769143, 324072436, 3348797215, 904991772, 648144872, 3570033899, 2329499855, 2024987596, 1809983544, 2575936315, 1296289744, 3207089363, 2893594407, 1578318884, 274646895, 3795141740, 4049975192, 51262619, 3619967088, 632279923, 922689671, 3298075524, 2592579488, 1760304291, 2075979607, 2312596564, 1562183871, 2943781820, 3156637768, 1313733451, 549293790, 3537243613, 3246849577, 871202090, 3878099393, 357341890, 102525238, 4101499445, 2858735121, 1477399826, 1264559846, 3107202533, 1845379342, 2677391885, 2361733625, 2125378298, 820201905, 3263744690, 3520608582, 598981189, 4151959214, 85089709, 373468761, 3827903834, 3124367742, 1213305469, 1526817161, 2842354314, 2107672161, 2412447074, 2627466902, 1861252501, 1098587580, 3004210879, 2688576843, 1378610760, 2262928035, 1955203488, 1742404180, 2511436119, 3416409459, 969524848, 714683780, 3639785095, 205050476, 4266873199, 3976438427, 526918040, 1361435347, 2739821008, 2954799652, 1114974503, 2529119692, 1691668175, 2005155131, 2247081528, 3690758684, 697762079, 986182379, 3366744552, 476452099, 3993867776, 4250756596, 255256311, 1640403810, 2477592673, 2164122517, 1922457750, 2791048317, 1412925310, 1197962378, 3037525897, 3944729517, 427051182, 170179418, 4165941337, 746937522, 3740196785, 3451792453, 1070968646, 1905808397, 2213795598, 2426610938, 1657317369, 3053634322, 1147748369, 1463399397, 2773627110, 4215344322, 153784257, 444234805, 3893493558, 1021025245, 3467647198, 3722505002, 797665321, 2197175160, 1889384571, 1674398607, 2443626636, 1164749927, 3070701412, 2757221520, 1446797203, 137323447, 4198817972, 3910406976, 461344835, 3484808360, 1037989803, 781091935, 3705997148, 2460548119, 1623424788, 1939049696, 2180517859, 1429367560, 2807687179, 3020495871, 1180866812, 410100952, 3927582683, 4182430767, 186734380, 3756733383, 763408580, 1053836080, 3434856499, 2722870694, 1344288421, 1131464017, 2971354706, 1708204729, 2545590714, 2229949006, 1988219213, 680717673, 3673779818, 3383336350, 1002577565, 4010310262, 493091189, 238226049, 4233660802, 2987750089, 1082061258, 1395524158, 2705686845, 1972364758, 2279892693, 2494862625, 1725896226, 952904198, 3399985413, 3656866545, 731699698, 4283874585, 222117402, 510512622, 3959836397, 3280807620, 837199303, 582374963, 3504198960, 68661723, 4135334616, 3844915500, 390545967, 1230274059, 3141532936, 2825850620, 1510247935, 2395924756, 2091215383, 1878366691, 2644384480, 3553878443, 565732008, 854102364, 3229815391, 340358836, 3861050807, 4117890627, 119113024, 1493875044, 2875275879, 3090270611, 1247431312, 2660249211, 1828433272, 2141937292, 2378227087, 3811616794, 291187481, 34330861, 4032846830, 615137029, 3603020806, 3314634738, 939183345, 1776939221, 2609017814, 2295496738, 2058945313, 2926798794, 1545135305, 1330124605, 3173225534, 4084100981, 17165430, 307568514, 3762199681, 888469610, 3332340585, 3587147933, 665062302, 2042050490, 2346497209, 2559330125, 1793573966, 3190661285, 1279665062, 1595330642, 2910671697];

Methods

from(value)

static from(value: ArrayBuffer | ArrayBufferView | CRC32CValidator | string | number): CRC32C;

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

Parameter
NameDescription
value ArrayBuffer | ArrayBufferView | CRC32CValidator | string | number

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

Returns
TypeDescription
CRC32C

fromFile(file)

static fromFile(file: PathLike): Promise<CRC32C>;
Parameter
NameDescription
file PathLike
Returns
TypeDescription
Promise<CRC32C>

toBuffer()

toBuffer(): Buffer;

Returns a Buffer representation of the CRC32C value

Returns
TypeDescription
Buffer

toJSON()

toJSON(): string;

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

See

Returns
TypeDescription
string

toString()

toString(): string;

Returns a base64-encoded representation of the CRC32C value.

See

Returns
TypeDescription
string

update(data)

update(data: Buffer): void;

Calculates a CRC32C from a provided buffer.

Implementation inspired from: - - -

Parameter
NameDescription
data Buffer

The Buffer to generate the CRC32C from

Returns
TypeDescription
void

validate(input)

validate(input: Buffer | CRC32CValidator | string | number): boolean;

Validates a provided input to the current CRC32C value.

Parameter
NameDescription
input "\"buffer\"".__global.Buffer | CRC32CValidator | string | number

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

Returns
TypeDescription
boolean

valueOf()

valueOf(): number;

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

See

Returns
TypeDescription
number