Interface CRC32CValidator (7.16.0)
Stay organized with collections
Save and categorize content based on your preferences.
An interface for CRC32C hashing and validation
Package
@google-cloud/storage
Properties
toString
toString
:
()
=
>
string
;
A method returning the CRC32C as a base64-encoded string.
Example Hashing the string 'data' should return 'rth90Q=='
js
const
buffer
=
Buffer
.
from
(
'data'
);
crc32c
.
update
(
buffer
);
crc32c
.
toString
();
// 'rth90Q=='
update
update
:
(
data
:
Buffer
)
=
>
void
;
A method for passing Buffer
s for CRC32C generation.
Example Hashing buffers from 'some ' and 'text\n'
js
const
buffer1
=
Buffer
.
from
(
'some '
);
crc32c
.
update
(
buffer1
);
const
buffer2
=
Buffer
.
from
(
'text\n'
);
crc32c
.
update
(
buffer2
);
crc32c
.
toString
();
// 'DkjKuA=='
validate
validate
:
(
value
:
string
)
=
>
boolean
;
A method validating a base64-encoded CRC32C string.
Example Should return true
if the value matches, false
otherwise
js
const
buffer
=
Buffer
.
from
(
'data'
);
crc32c
.
update
(
buffer
);
crc32c
.
validate
(
'DkjKuA=='
);
// false
crc32c
.
validate
(
'rth90Q=='
);
// true
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Interface CRC32CValidator (7.16.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.16.0 (latest)](/nodejs/docs/reference/storage/latest/storage/crc32cvalidator)\n- [7.13.0](/nodejs/docs/reference/storage/7.13.0/storage/crc32cvalidator)\n- [7.3.2](/nodejs/docs/reference/storage/7.3.2/storage/crc32cvalidator)\n- [7.2.0](/nodejs/docs/reference/storage/7.2.0/storage/crc32cvalidator)\n- [7.1.0](/nodejs/docs/reference/storage/7.1.0/storage/crc32cvalidator)\n- [7.0.1](/nodejs/docs/reference/storage/7.0.1/storage/crc32cvalidator)\n- [6.12.0](/nodejs/docs/reference/storage/6.12.0/storage/crc32cvalidator)\n- [6.11.0](/nodejs/docs/reference/storage/6.11.0/storage/crc32cvalidator)\n- [6.7.0](/nodejs/docs/reference/storage/6.7.0/storage/crc32cvalidator)\n- [6.6.0](/nodejs/docs/reference/storage/6.6.0/storage/crc32cvalidator)\n- [6.5.4](/nodejs/docs/reference/storage/6.5.4/storage/crc32cvalidator)\n- [6.4.2](/nodejs/docs/reference/storage/6.4.2/storage/crc32cvalidator)\n- [6.3.0](/nodejs/docs/reference/storage/6.3.0/storage/crc32cvalidator)\n- [6.2.3](/nodejs/docs/reference/storage/6.2.3/storage/crc32cvalidator)\n- [5.19.1](/nodejs/docs/reference/storage/5.19.1/storage/crc32cvalidator)\n- [5.18.3](/nodejs/docs/reference/storage/5.18.3/storage/crc32cvalidator)\n- [5.17.0](/nodejs/docs/reference/storage/5.17.0/storage/crc32cvalidator)\n- [5.16.1](/nodejs/docs/reference/storage/5.16.1/storage/crc32cvalidator)\n- [5.15.6](/nodejs/docs/reference/storage/5.15.6/storage/crc32cvalidator)\n- [5.14.8](/nodejs/docs/reference/storage/5.14.8/storage/crc32cvalidator)\n- [5.13.2](/nodejs/docs/reference/storage/5.13.2/storage/crc32cvalidator)\n- [5.12.0](/nodejs/docs/reference/storage/5.12.0/storage/crc32cvalidator)\n- [5.11.1](/nodejs/docs/reference/storage/5.11.1/storage/crc32cvalidator)\n- [5.10.0](/nodejs/docs/reference/storage/5.10.0/storage/crc32cvalidator)\n- [5.9.0](/nodejs/docs/reference/storage/5.9.0/storage/crc32cvalidator)\n- [5.8.5](/nodejs/docs/reference/storage/5.8.5/storage/crc32cvalidator) \nAn interface for CRC32C hashing and validation\n\nPackage\n-------\n\n[@google-cloud/storage](../overview.html)\n\nProperties\n----------\n\n### toString\n\n toString: () =\u003e string;\n\nA method returning the CRC32C as a base64-encoded string.\n**Example**\n\nHashing the string 'data' should return 'rth90Q==' \n\n js\n const buffer = Buffer.from('data');\n crc32c.update(buffer);\n crc32c.toString(); // 'rth90Q=='\n\n### update\n\n update: (data: Buffer) =\u003e void;\n\nA method for passing `Buffer`s for CRC32C generation.\n**Example**\n\nHashing buffers from 'some ' and 'text\\\\n' \n\n js\n const buffer1 = Buffer.from('some ');\n crc32c.update(buffer1);\n\n const buffer2 = Buffer.from('text\\n');\n crc32c.update(buffer2);\n\n crc32c.toString(); // 'DkjKuA=='\n\n### validate\n\n validate: (value: string) =\u003e boolean;\n\nA method validating a base64-encoded CRC32C string.\n**Example**\n\nShould return `true` if the value matches, `false` otherwise \n\n js\n const buffer = Buffer.from('data');\n crc32c.update(buffer);\n crc32c.validate('DkjKuA=='); // false\n crc32c.validate('rth90Q=='); // true"]]