Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bloem

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bloem - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

5

bloem.js

@@ -1,2 +0,2 @@

"use strict";
"use strict"

@@ -86,3 +86,3 @@ var BitBuffer = require('bitbuffer').BitBuffer

this.scaling = options.scaling || 2
this.initial_capacity = options.initial_capacity|| 1000
this.initial_capacity = options.initial_capacity || 1000
this.filters = [new SafeBloem(this.initial_capacity, error_rate * (1 - this.ratio))]

@@ -111,3 +111,2 @@ }

exports.Bloem = Bloem

@@ -114,0 +113,0 @@ exports.SafeBloem = SafeBloem

10

package.json
{
"name": "bloem",
"version": "0.2.0",
"version": "0.2.1",
"author": "Sebastian Wiedenroth <wiedi@frubar.net>",

@@ -8,2 +8,10 @@ "description": "Bloom Filter using the FNV hash function",

"main": "bloem.js",
"repository": {
"type": "git",
"url": "https://github.com/wiedi/node-bloem.git"
},
"keywords": [
"bloom filter",
"scalable bloom filters"
],
"dependencies": {

@@ -10,0 +18,0 @@ "fnv": "0.1.x",

@@ -25,3 +25,3 @@ # Bloem - Bloom Filter for node.js

##### SafeBloem
#### SafeBloem

@@ -37,2 +37,75 @@ var bloem = require('bloem')

## API
### Class: Bloem
##### new Bloem(size, slices)
- <code>size</code> Number - bits in the bitfield
- <code>slices</code> Number - how many hashfunctions to use
Create a new Bloem filter object.
##### filter.add(key)
- <code>key</code> Buffer - key to add
Add a key to the set
##### filter.has(key)
- <code>key</code> Buffer
Test if key is in the set
### Class: SafeBloem
##### new SafeBloem(capacity, error_rate)
- <code>capacity</code> Number - capacity of the filter
- <code>error_rate</code> Number
Create a new bloom filter that can hold <code>capacity</code> elements with an error probability of <code>error_rate</code>.
##### filter.add(key)
- <code>key</code> Buffer - key to add
Add a key to the set. Returnes true on success and false if the filter is full.
##### filter.has(key)
- <code>key</code> Buffer
Test if key is in the set
### Class: ScalingBloem
##### new ScalingBloem(error_rate, options)
- <code>error_rate</code> Number
Creates an instance of a scaling bloom filter. Accepts a "options" Object that takes the following values:
- <code>initial_capacity</code> - the capacity of the first filter. Default: 1000
- <code>scaling</code> - the scaling factor. Use 2 here for less space usage but higher cpu usage or 4 for higher space, but lower cpu usage. Default: 2
- <code>ratio</code> - tightening ratio with 0 < ratio < 1. Default: 0.9
##### filter.add(key)
- <code>key</code> Buffer - key to add
Add a key to the set
##### filter.has(key)
- <code>key</code> Buffer
Test if key is in the set
## References

@@ -39,0 +112,0 @@

@@ -1,2 +0,2 @@

"use strict";
"use strict"
var assert = require("assert")

@@ -3,0 +3,0 @@ var bloem = require('./bloem')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc