View Source Base85 (Base85 v1.1.0)
A pure-Elixir implementation of some 85-character encodings.
While Base64 is well known and quite functional, it is not the most efficient encoding for turning binary data into a stream of ASCII-friendly text. This module implements some Base85 encodings in pure Elixir, with no NIF or external dependencies. As the name suggests, it encodes data using a numbering system with a radix of 85. This number is chosen because it approximates the maximum number of characters in the "safe" range that can be effectively used.
While it is possible to squeeze out a few more, it doesn't actually save any characters. So, from an efficiency standpoint, Base85 is about as good as it gets. And the small number of characters you have left over, you can tune the generated output to avoid characters that are "dangerous" in certain transports.
By default, encoding uses the Safe85 character set with PKCS7 padding, which allows arbitrary-length input to round-trip correctly.
This module holds references to the primary entrypoints for using this library.
Summary
Functions
@spec decode_stream( stream :: Enumerable.t(binary()), keyword() ) :: {:ok, Enumerable.t(binary())} | {:error, any()}
@spec decode_stream!( stream :: Enumerable.t(binary()), keyword() ) :: Enumerable.t(binary())
@spec encode_stream( stream :: Enumerable.t(binary()), keyword() ) :: {:ok, Enumerable.t(binary())} | {:error, any()}
@spec encode_stream!( stream :: Enumerable.t(binary()), keyword() ) :: Enumerable.t(binary())