Interface CRC32CValidator (7.16.0)

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=='

jsconstbuffer=Buffer.from('data');crc32c.update(buffer);crc32c.toString();// 'rth90Q=='

update

update:(data:Buffer)=>void;

A method for passingBuffers for CRC32C generation.

Example

Hashing buffers from 'some ' and 'text\n'

jsconstbuffer1=Buffer.from('some ');crc32c.update(buffer1);constbuffer2=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 returntrue if the value matches,false otherwise

jsconstbuffer=Buffer.from('data');crc32c.update(buffer);crc32c.validate('DkjKuA==');// falsecrc32c.validate('rth90Q==');// true

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.