1.1.1 • Published 5 years ago

atbf v1.1.1

Weekly downloads
418
License
LGPL-3.0
Repository
gitlab
Last release
5 years ago

atbf

Build Status

This package provides a simple attenuated bloom filter. An attenuated bloom filter is a series of bloom filters that can be used to represent items in sets over a sort of distance plot. This is useful in particular for things like Quasar where each bloom filter in the set is used to represent topics to which peers N hops aways are subscribed.

Usage

npm install atbf --save
const AttenuatedBloomFilter = require('atbf');
const atbf = new AttenuatedBloomFilter({ bitfieldSize: 160, filterDepth: 3 });

atbf[0].add(Buffer.from('some item'));
atbf[0].has(Buffer.from('some item')); // true
atbf[0].has(Buffer.from('other item')); // false

The AttenuatedBloomFilter object extends Array, so the usual suspects like map, forEach, etc are available.

License

GNU Lesser General Public License 3.0