Update usage notes for [de]serialisation.

This commit is contained in:
Jason Davies 2013-05-31 21:53:14 +01:00
parent 318ebca0a8
commit 7100918e36
1 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,16 @@ Usage
bloom.test("bar");
bloom.test("blah");
// Serialisation. Note that bloom.buckets may be a typed array,
// so we convert to a normal array first.
var array = [].slice.call(bloom.buckets),
json = JSON.stringify(array);
// Deserialisation. Note that the any array-like object is supported, but
// this will be used directly, so you may wish to use a typed array for
// performance.
var bloom = new BloomFilter(array, 3);
Implementation
--------------