View Source jhn_bencoding (jhn_stdlib v5.3.2)
A Bencoding library based on: The BitTorrent specification
Bencoding is represented as follows:
Byte string : binary (octets) Integer : integer List : list Dictionary : map
Summary
Functions
Decodes the iodata into a structured Erlang term. Equivalent of decode(JSON, []) -> Term.
Decodes the iodata into a structured Erlang term. Options are: continue -> return the tuple of the decoded Bencoding and the remaining binary
Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> Bencoding.
Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned iolist -> an iolist is returned (default)
Types
-type opt() :: binary | iolist | continue.
Functions
Decodes the iodata into a structured Erlang term. Equivalent of decode(JSON, []) -> Term.
Decodes the iodata into a structured Erlang term. Options are: continue -> return the tuple of the decoded Bencoding and the remaining binary
Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> Bencoding.
Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned iolist -> an iolist is returned (default)