BinaryFuse8
Defined in: packages/distillate/src/fuse/fuse.ts:419
A static 8-bit binary fuse filter: built once from a key set, then immutable. The most space-efficient option (~9 bits/key at ~0.39% false-positive rate).
Example
Section titled “Example”const filter = BinaryFuse8.from(["alice", "bob", "carol"]);filter.has("alice"); // truefilter.size; // 3Extends
Section titled “Extends”BinaryFuse
Accessors
Section titled “Accessors”bitsPerKey
Section titled “bitsPerKey”Get Signature
Section titled “Get Signature”get bitsPerKey():
number
Defined in: packages/distillate/src/fuse/fuse.ts:326
Actual bits stored per key (0 for an empty filter).
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BinaryFuse.bitsPerKey
Get Signature
Section titled “Get Signature”get seed():
number
Defined in: packages/distillate/src/fuse/fuse.ts:321
Hash seed selected during construction (may differ from 0 after a peel retry).
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BinaryFuse.seed
Get Signature
Section titled “Get Signature”get size():
number
Defined in: packages/distillate/src/fuse/fuse.ts:316
Number of distinct keys the filter was built from.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BinaryFuse.size
Methods
Section titled “Methods”equals()
Section titled “equals()”equals(
other):boolean
Defined in: packages/distillate/src/fuse/fuse.ts:393
Tests structural equality: true when other serializes to identical
bytes. A BinaryFuse8 and a BinaryFuse16 are never equal,
since their frames carry different type bytes.
Parameters
Section titled “Parameters”BinaryFuse8 | BinaryFuse16
The filter to compare against.
Returns
Section titled “Returns”boolean
true if the two filters are byte-for-byte identical.
Inherited from
Section titled “Inherited from”BinaryFuse.equals
has(
key):boolean
Defined in: packages/distillate/src/fuse/fuse.ts:361
Tests whether a key is in the set.
Parameters
Section titled “Parameters”BytesLike
The key to test.
Returns
Section titled “Returns”boolean
true if present (possibly a false positive); false guarantees absence.
Inherited from
Section titled “Inherited from”BinaryFuse.has
toBytes()
Section titled “toBytes()”toBytes():
Uint8Array
Defined in: packages/distillate/src/fuse/fuse.ts:335
Serializes the filter to a portable little-endian byte layout.
Returns
Section titled “Returns”Uint8Array
The serialized filter, readable by the matching fromBytes.
Inherited from
Section titled “Inherited from”BinaryFuse.toBytes
toJSON()
Section titled “toJSON()”toJSON():
FilterJSON
Defined in: packages/distillate/src/fuse/fuse.ts:403
Serializes the filter to a JSON-friendly envelope wrapping the base64 of
the toBytes frame.
Returns
Section titled “Returns”The envelope, readable by the matching fromJSON.
Inherited from
Section titled “Inherited from”BinaryFuse.toJSON
from()
Section titled “from()”
staticfrom(keys):BinaryFuse8
Defined in: packages/distillate/src/fuse/fuse.ts:427
Builds a filter from the given keys; duplicates are ignored.
Parameters
Section titled “Parameters”Iterable<BytesLike>
The complete set of keys to store.
Returns
Section titled “Returns”BinaryFuse8
A new immutable filter.
Throws
Section titled “Throws”BinaryFuseBuildError if construction fails to converge.
fromBytes()
Section titled “fromBytes()”
staticfromBytes(bytes):BinaryFuse8
Defined in: packages/distillate/src/fuse/fuse.ts:437
Restores a filter from its BinaryFuse8.toBytes serialization.
Parameters
Section titled “Parameters”Uint8Array
The serialized filter.
Returns
Section titled “Returns”BinaryFuse8
The reconstructed filter.
fromJSON()
Section titled “fromJSON()”
staticfromJSON(value):BinaryFuse8
Defined in: packages/distillate/src/fuse/fuse.ts:447
Restores a filter from its BinaryFuse8.toJSON envelope.
Parameters
Section titled “Parameters”unknown
The JSON envelope.
Returns
Section titled “Returns”BinaryFuse8
The reconstructed filter.