types.d.ts 610 B

12345678910111213141516171819
  1. export type XXHash<T> = {
  2. update(input: string | Uint8Array): XXHash<T>;
  3. digest(): T;
  4. }
  5. export type XXHashAPI = {
  6. h32(input: string, seed?: number): number;
  7. h32ToString(input: string, seed?: number): string;
  8. h32Raw(inputBuffer: Uint8Array, seed?: number): number;
  9. create32(seed?: number): XXHash<number>;
  10. h64(input: string, seed?: bigint): bigint;
  11. h64ToString(input: string, seed?: bigint): string;
  12. h64Raw(inputBuffer: Uint8Array, seed?: bigint): bigint;
  13. create64(seed?: bigint): XXHash<bigint>;
  14. };
  15. declare module "xxhash-wasm" {
  16. export default function xxhash(): Promise<XXHashAPI>;
  17. }