jaybaird / python-bloomfilter

Scalable Bloom Filter implemented in Python
MIT License
1.62k stars 330 forks source link

Load bloom filter from bytes (instead of loading from file) #44

Open jonsnowseven opened 3 years ago

jonsnowseven commented 3 years ago

Hello.

Is there a way to load a Bloom Filter from bytes instead of loading from a file? The advantage is that we do not need to download a file to load a Bloom Filter.

Thank you in advance.

jonsnowseven commented 3 years ago

I ended up doing a workaround:

import io
import pybloom_live

with open(<bloomfilter_file>, "rb") as f:
    bytes_io = io.BytesIO(f.read())

pybloom_live.BloomFilter.fromfile(bytes_io)
yankun1992 commented 2 years ago

Maybe you can try fastbloom. A super fast bloom filter | counting bloom filter implemented by Rust for Python!