How do I install bloom-filter

I would like to install . It is not part of bitcore, but it is very related and I am having trouble.

I tried

npm install bloom-filter

but this gives me a directory of files and I am not sure what to do. I tried

browserify ../node_modules/bloom-filter/lib/index.js -o js/filter.js

and then I included “js/filter.js” in my HTML, just like I was able to do with bitcore, yet I still get this error in my console:

Uncaught Error: Cannot find module 'bloom-filter'

and so now I am confused

To build a browser version you can run:

cd /path/to/bloom-filter
browserify --require ./lib/index.js:bloom-filter -o bloom-filter.js
<!doctype html>
<html lang=en-us>
    <meta charset=utf-8>
    <title>Bloom Filter</title>
    <script src="bloom-filter.js"></script>
      var BloomFilter = require('bloom-filter');
1 Like

It worked! Thank you for the guide.