Snappywrap (snappywrap v0.1.2)

View Source

A pure Elixir library to wrap a binary as uncompressed data in Snappy format.

This library does not provide compress/decompress functions, but only wraps the data in Snappy framing or block format that can be decompressed (decoded) by Snappy-compatible libraries.

This library is mostly for testing and/or low performance situations where using NIFs such as snappyrex is not required.

Summary

Functions

Wraps binary data in Snappy block format.

Wraps binary data in Snappy framing format.

Functions

wrap(data)

@spec wrap(binary()) :: {:ok, binary()} | {:error, String.t()}

Wraps binary data in Snappy block format.

Returns {:ok, wrapped} when the input is within the supported Snappy size limit of 2^32 - 1 bytes, or {:error, message} when it is too large.

This function only accepts binaries. Passing any other type raises a FunctionClauseError.

wrap_framed(data)

@spec wrap_framed(binary()) :: {:ok, binary()} | {:error, String.t()}

Wraps binary data in Snappy framing format.

Returns {:ok, wrapped} when the input is within the supported Snappy size limit of 2^32 - 1 bytes, or {:error, message} when it is too large.

This function only accepts binaries. Passing any other type raises a FunctionClauseError.