Netstrings v2.0.0 Netstrings
netstring encoding and decoding
An implementation of djb’s netstrings.
Please note that the decoder violates spec by accepting leading zeros in the len
part.
However, the encoder will never generate such leading zeros.
Summary
Functions
Decode netstrings
Decode netstrings, raise exception on error
Encode a netstring
Encode a netstring, raise exception on error
Converts an io device into a Netstrings.Stream
Functions
Decode netstrings
The decoder will stop as soon as it encounters an improper or incomplete netstring. Upon success, decoded strings will appear in the second element of the tuple as a list. Any remaining (undecoded) part of the string will appear as the third element.
There are no guarantees that the remainder is the start of a proper netstring. Appending more received data to the remainder may or may not allow it to be decoded.
Decode netstrings, raise exception on error
Note that the strings must be correct and complete, having any remainder will raise an exception.
Encode a netstring, raise exception on error
Specs
stream(atom | pid) :: Enumerable.t
Converts an io device into a Netstrings.Stream
Behaves similarly to an IO.Stream
with the values marshaled into and out of
netstring format. The device should be opened in raw format for predictability.
Note that netstrings approaching or above 64kib may not be properly handled.