Skip to content

Repository files navigation

distillate

CI npm license

Probabilistic data structures for JavaScript: space-efficient, approximate-membership filters (Bloom, Blocked Bloom, Binary Fuse) with tunable error and zero false negatives. TypeScript-first, zero runtime dependencies, and universal (Node, Bun, Deno, browser, edge).

Pre-release (0.x). The published structures are correct, tested, and benchmarked, but the public API may still change before 1.0. Pin a version if you depend on it.

npm install distillate
import { BloomFilter } from "distillate/bloom";

const filter = BloomFilter.create(100_000, 0.01); // capacity, target FPR
filter.add("alice");
filter.has("alice"); // true
filter.has("bob"); // false (or a ~1% false positive)

const restored = BloomFilter.fromBytes(filter.toBytes()); // portable binary format

Each structure is its own subpath, so you only bundle what you import:

Import Structure Mutable? Use for
distillate/bloom Classic Bloom yes Familiar default, migration from bloom-filters
distillate/blocked Blocked Bloom yes Faster lookups and a lower FPR for ~15% more space
distillate/fuse Binary Fuse no Static set built once and queried a lot; least space

Full install, usage, runtime support, and benchmarks are in the package README.

Repository

This is a pnpm workspace.

Package Path Description
distillate packages/distillate The published library.
distillate-bench (private) apps/bench Cross-library benchmark (vs bloom-filters / bloomfilter.js) on workspace:*, so it always measures local source.

Development

pnpm install      # sets up git hooks (Husky)
pnpm build        # tsdown, across packages
pnpm test         # Vitest, across packages
pnpm lint         # type-aware ESLint
pnpm format:check

Library-specific tasks target the package: pnpm --filter distillate <coverage|check|api:check|docs:api|bench>. Releases run through Changesets at the root (pnpm changeset). See CONTRIBUTING.md.

Docs

Design notes, the structure decision matrix, hashing, and the binary format live under packages/distillate/docs:

License

MIT © Akshay

Releases

Packages

Used by

Contributors

Languages