Skip to content

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).

const filter = BinaryFuse8.from(["alice", "bob", "carol"]);
filter.has("alice"); // true
filter.size; // 3
  • BinaryFuse

get bitsPerKey(): number

Defined in: packages/distillate/src/fuse/fuse.ts:326

Actual bits stored per key (0 for an empty filter).

number

BinaryFuse.bitsPerKey


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).

number

BinaryFuse.seed


get size(): number

Defined in: packages/distillate/src/fuse/fuse.ts:316

Number of distinct keys the filter was built from.

number

BinaryFuse.size

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.

BinaryFuse8 | BinaryFuse16

The filter to compare against.

boolean

true if the two filters are byte-for-byte identical.

BinaryFuse.equals


has(key): boolean

Defined in: packages/distillate/src/fuse/fuse.ts:361

Tests whether a key is in the set.

BytesLike

The key to test.

boolean

true if present (possibly a false positive); false guarantees absence.

BinaryFuse.has


toBytes(): Uint8Array

Defined in: packages/distillate/src/fuse/fuse.ts:335

Serializes the filter to a portable little-endian byte layout.

Uint8Array

The serialized filter, readable by the matching fromBytes.

BinaryFuse.toBytes


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.

FilterJSON

The envelope, readable by the matching fromJSON.

BinaryFuse.toJSON


static from(keys): BinaryFuse8

Defined in: packages/distillate/src/fuse/fuse.ts:427

Builds a filter from the given keys; duplicates are ignored.

Iterable<BytesLike>

The complete set of keys to store.

BinaryFuse8

A new immutable filter.

BinaryFuseBuildError if construction fails to converge.


static fromBytes(bytes): BinaryFuse8

Defined in: packages/distillate/src/fuse/fuse.ts:437

Restores a filter from its BinaryFuse8.toBytes serialization.

Uint8Array

The serialized filter.

BinaryFuse8

The reconstructed filter.


static fromJSON(value): BinaryFuse8

Defined in: packages/distillate/src/fuse/fuse.ts:447

Restores a filter from its BinaryFuse8.toJSON envelope.

unknown

The JSON envelope.

BinaryFuse8

The reconstructed filter.