From 7100918e367e333f8d079cabceb826eb70863349 Mon Sep 17 00:00:00 2001 From: Jason Davies Date: Fri, 31 May 2013 21:53:14 +0100 Subject: [PATCH] Update usage notes for [de]serialisation. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index cf3e924..7ac1df2 100644 --- a/README.md +++ b/README.md @@ -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 --------------