diff --git a/README.md b/README.md index 3584d2c6..7cf23f85 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,20 @@ b"bytes here" Where the API is `cramjam..compress/decompress` and accepts both `bytes` and `bytearray` objects. +**de/compress_into** +Additionally, all variants except for lz4, support `decompress_into` and `compress_into`. +If you have a numpy array preallocated, that can be used as the output location for de/compression. +Ex. +```python +>>> from cramjam import snappy +>>> import numpy as np +>>> compressed_data # some data that we know the size of when decompressed +>>> output = np.zeros(<>, dtype=np.uint8) +>>> snappy.decompress_into(compressed_data, output) # returns number of bytes decoded +<> +``` +This is very fast, as it avoids any buffer allocations on the rust side. + **Special note!** If you know the length of the de/compress output, you can provide `output_len=<>` to any `de/compress`