Creates a new streaming hash instance with an optional 64-bit seed.
Lower 32 bits of the 64-bit seed. Default: 0.
Upper 32 bits of the 64-bit seed. Default: 0.
Upper 32 bits of the 64-bit seed.
Lower 32 bits of the 64-bit seed.
Returns true if an async operation (addFile, addFiles, addFilesParallel)
is currently in flight. While busy, synchronous methods will throw.
Feeds an entire binary buffer into the running hash state.
Binary data to feed.
Feeds a subrange of a binary buffer into the running hash state.
Binary data.
Starting byte offset.
Optionallength: numberNumber of bytes. If omitted, feeds to end of buffer.
Reads a single file and feeds its content into the running hash state.
Marks the instance as busy until the returned promise settles.
File path.
If true (default), rejects on I/O error. If false, silently skips.
Reads multiple files sequentially and feeds each into the running hash state.
Marks the instance as busy until the returned promise settles.
Array of file paths.
If true (default), rejects on I/O error. If false, silently skips.
Reads multiple files in parallel and feeds each into the running hash state.
Marks the instance as busy until the returned promise settles.
Per-file digests are computed in parallel and then fed into the stream in path-order.
File paths.
Max concurrent I/O lanes (0 = default, max 8).
If true (default), rejects on I/O error. If false, unreadable files produce a zero hash.
Feeds a UTF-8 string into the running hash state.
String to feed.
Returns a new independent stream with a copy of the current hash state. The cloned stream shares no state with the original.
Finalizes and returns the current 128-bit digest.
The internal state is not reset — calling digest() again without further feeds returns the same value.
A new 16-byte Buffer containing the digest.
Finalizes and writes the 128-bit digest into an existing output buffer.
Destination buffer (>= 16 writable bytes at outOffset).
OptionaloutOffset: numberByte offset in out. Default: 0.
The out buffer for convenience.
Resets the internal hash state, discarding all previously fed data.
OptionalseedLow: numberLower 32 bits of the 64-bit seed. Default: the seed used at construction.
OptionalseedHigh: numberUpper 32 bits of the 64-bit seed. Default: the seed used at construction.
StaticdigestHashes an entire binary buffer and returns the 128-bit digest.
The buffer to hash.
StaticdigestHashes a sub-range of a binary buffer and returns the 128-bit digest.
The buffer to hash.
Start offset in bytes.
Optionallength: numberNumber of bytes to hash. Defaults to the rest of the buffer.
StaticdigestHashes a sub-range of a binary buffer and writes the digest into out.
The buffer to hash.
Start offset in bytes.
Number of bytes to hash.
Destination buffer.
OptionaloutOffset: numberByte offset into out. Default 0.
StaticdigestHashes an entire binary buffer and writes the digest into out.
The buffer to hash.
Destination buffer (must have at least 16 bytes from outOffset).
OptionaloutOffset: numberByte offset into out. Default 0.
StaticdigestReads a file and returns its 128-bit content hash.
File path.
OptionalthrowOnError: booleanIf false, returns a zeroed digest on error. Default true.
StaticdigestReads multiple files in parallel and returns the aggregate 128-bit digest.
Array of file paths.
Max parallel reads. Default 8.
OptionalthrowOnError: booleanIf false, skips unreadable files. Default true.
StaticdigestReads multiple files in parallel and writes the aggregate digest into out.
Array of file paths.
Destination buffer.
OptionaloutOffset: numberByte offset into out. Default 0.
Max parallel reads. Default 8.
OptionalthrowOnError: booleanIf false, skips unreadable files. Default true.
StaticdigestReads multiple files sequentially and returns the aggregate 128-bit digest.
Array of file paths.
OptionalthrowOnError: booleanIf false, skips unreadable files. Default true.
StaticdigestReads multiple files sequentially and writes the aggregate digest into out.
Array of file paths.
Destination buffer.
OptionaloutOffset: numberByte offset into out. Default 0.
OptionalthrowOnError: booleanIf false, skips unreadable files. Default true.
StaticdigestReads a file and writes its 128-bit content hash into out.
File path.
Destination buffer.
OptionaloutOffset: numberByte offset into out. Default 0.
OptionalthrowOnError: booleanIf false, writes a zeroed digest on error. Default true.
StaticdigestHashes a UTF-8 string and returns the 128-bit digest.
The string to hash.
StaticdigestStatichashOne-shot: hash a buffer or string and return the 128-bit digest.
Binary data or string to hash.
A new 16-byte Buffer containing the digest.
Streaming (incremental) and one-shot xxHash3-128 hasher.
Streaming usage: create an instance, feed data via
addBuffer,addString,addFile, etc., then calldigest()to finalize.One-shot usage: call static methods like
XxHash128Stream.digestBuffer(data)orXxHash128Stream.hash(input)directly.Busy guard: Async methods (
addFile,addFiles,addFilesParallel) mark the instance as busy while the native worker is in flight. During this time, calling any synchronous method (addBuffer,addString,digest,reset,clone) or starting another async operation will throw. Checkbusyto inspect the state, or simplyawaiteach async call before invoking another method.Example