An object that provides a hash of data provided in chunks to update. The hash may be performed incrementally as chunks are received or all at once when the hash is finalized, depending on the underlying implementation.

Deprecated

use Checksum

interface Hash {
    digest(): Promise<Uint8Array<ArrayBufferLike>>;
    update(toHash, encoding?): void;
}

Methods

Methods

  • Finalizes the hash and provides a promise that will be fulfilled with the raw bytes of the calculated hash.

    Returns Promise<Uint8Array<ArrayBufferLike>>

  • Adds a chunk of data to the hash. If a buffer is provided, the encoding argument will be ignored. If a string is provided without a specified encoding, implementations must assume UTF-8 encoding.

    Not all encodings are supported on all platforms, though all must support UTF-8.

    Parameters

    • toHash: SourceData
    • Optional encoding: "utf8" | "ascii" | "latin1"

    Returns void