image-in-browser
Version:
Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)
41 lines (40 loc) • 1.51 kB
TypeScript
/** @format */
/**
* Interface representing options for CRC32 calculation.
*/
export interface Crc32Options {
/** The buffer containing the data to calculate the CRC32 checksum for. */
buffer: Uint8Array;
/** The base CRC value to start with (optional). */
baseCrc?: number;
/** The position in the buffer to start calculating from (optional). */
position?: number;
/** The length of the data to calculate the checksum for (optional). */
length?: number;
}
/**
* Abstract class providing CRC32 checksum calculation methods.
*/
export declare abstract class Crc32 {
/**
* The CRC32 lookup table.
* @private
*/
private static readonly _crcTable;
/**
* Creates the CRC32 lookup table.
* @returns {number[]} The CRC32 lookup table.
* @private
*/
private static makeTable;
/**
* Calculates the CRC32 checksum for the given options.
* @param {Crc32Options} opt - The options for CRC32 calculation.
* @param {Uint8Array} opt.buffer - The buffer containing the data to calculate the CRC32 checksum for.
* @param {number} [opt.baseCrc] - The base CRC value to start with (optional).
* @param {number} [opt.position] - The position in the buffer to start calculating from (optional).
* @param {number} [opt.length] - The length of the data to calculate the checksum for (optional).
* @returns {number} The calculated CRC32 checksum.
*/
static getChecksum(opt: Crc32Options): number;
}