SnappyEx (snappyex v0.1.2)
View SourcePublic API for raw Snappy blocks.
compress/1 and decompress/1 work with the standard raw Snappy block
format: an uncompressed-size varint followed by literal and copy commands.
compress_framed/1 and decompress_framed/1 work with the Snappy framed
stream format. compress_framed_stream/1 and decompress_framed_stream/2
provide lazy, bounded-memory framed processing.
Summary
Functions
Compresses a binary into the raw Snappy block format.
Compresses a binary into the Snappy framed stream format.
Lazily compresses a binary or enumerable of iodata chunks into a Snappy framed stream.
Decompresses a raw Snappy block.
Decompresses a raw Snappy block, raising ArgumentError for malformed input.
Decompresses a Snappy framed stream.
Decompresses a Snappy framed stream, raising ArgumentError for malformed input.
Lazily decompresses a binary or enumerable of iodata chunks containing a Snappy framed stream.
Types
Functions
Compresses a binary into the raw Snappy block format.
Compresses a binary into the Snappy framed stream format.
@spec compress_framed_stream(binary() | Enumerable.t()) :: Enumerable.t()
Lazily compresses a binary or enumerable of iodata chunks into a Snappy framed stream.
The returned stream yields binary frame fragments and begins with the stream
identifier. Concatenating the fragments produces the same bytes as
compress_framed/1 for the same input.
@spec decompress(binary()) :: {:ok, binary()} | {:error, decompress_error()}
Decompresses a raw Snappy block.
Returns {:ok, binary} on success or {:error, reason} for malformed input.
Decompresses a raw Snappy block, raising ArgumentError for malformed input.
@spec decompress_framed(binary()) :: {:ok, binary()} | {:error, framed_decompress_error()}
Decompresses a Snappy framed stream.
Returns {:ok, binary} on success or {:error, reason} for malformed input.
Decompresses a Snappy framed stream, raising ArgumentError for malformed input.
@spec decompress_framed_stream( binary() | Enumerable.t(), keyword() ) :: Enumerable.t()
Lazily decompresses a binary or enumerable of iodata chunks containing a Snappy framed stream.
Each yielded binary is a complete checksum-verified data chunk. Input may be split at arbitrary byte boundaries.
Options
:max_output_size- maximum total number of uncompressed bytes to yield, or:infinityfor no aggregate limit. Defaults to:infinity.
Malformed input and output-limit violations raise ArgumentError when the
returned stream reaches the offending chunk. Unread input is not validated.