Writing BinPickle Files¶
The easy, single-function entry point for saving data is
from binpickle import dump dump(obj, 'file.bpk')
dump(obj, file, *, mappable=False, codec=<binpickle.codecs.blosc.Blosc object>)¶
Dump an object to a BinPickle file. This is a convenience wrapper around
To save with default compression for storage or transport:
To save in a file optimized for memory-mapping:
dump(obj, 'file.bpk', mappable=True)
For full control over the serialization process, you can directly use the
binpickle.BinPickler backend class.
BinPickler(filename, *, align=False, codec=None)¶
Save an object into a binary pickle file. This is like
pickle.Pickler, except it works on file paths instead of byte streams.
A BinPickler is also a context manager that closes itself when exited:
with BinPickler('file.bpk') as bpk: bpk.dump(obj)
Convenience method to construct a pickler for memory-mapped use.
compressed(filename, codec=<binpickle.codecs.blosc.Blosc object>)¶
Convenience method to construct a pickler for compressed storage.
Dump an object to the file. Can only be called once.
Close the bin pickler.