resx_base v0.1.0 ResxBase.Encoder
Encode data resources into a RFC 4648 encoding.
Encoding
The type of encoding is specified by using the :encoding
option.
Resx.Resource.transform(resource, ResxBase.Encoder, encoding: :base64)
The list of available encoding formats to choose from are:
:base16
- By default this works the same asBase.encode16/1
. Optionally the case can be specified using the:case
option, this can be either:lower
(for lowercase output) or:upper
(for uppercase output).:base32
- By default this works the same asBase.encode32/1
.:base64
- By default this works the same asBase.encode64/1
.:hex32
- By default this works the same asBase.hex_encode32/1
.:url64
- By default this works the same asBase.url_encode64/1
.
All encodings also take the configuration options specified in ResxBase
.
Streams
Streams are encoded by forming a complete sequence and separating each encoded sequence with the necessary amount of padding characters.
e.g. If you encoded "hello world"
as a single base64 sequence you would end up with the encoded data: "aGVsbG8gd29ybGQ="
. However if it was a stream consisting of ["hello", " ", "world"]
, it would be encoded as 3 individual sequences resulting in the encoded data: "aGVsbG8=IA==d29ybGQ="