Skip to content

BinaryFuse16

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

A static 16-bit binary fuse filter: like BinaryFuse8 but twice the space (~18 bits/key) for a far lower false-positive rate (~1/65536).

const filter = BinaryFuse16.from(["alice", "bob", "carol"]);
filter.has("alice"); // true
  • 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): BinaryFuse16

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

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

Iterable<BytesLike>

The complete set of keys to store.

BinaryFuse16

A new immutable filter.

BinaryFuseBuildError if construction fails to converge.


static fromBytes(bytes): BinaryFuse16

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

Restores a filter from its BinaryFuse16.toBytes serialization.

Uint8Array

The serialized filter.

BinaryFuse16

The reconstructed filter.


static fromJSON(value): BinaryFuse16

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

Restores a filter from its BinaryFuse16.toJSON envelope.

unknown

The JSON envelope.

BinaryFuse16

The reconstructed filter.