View Source bencode (erl_bencode v1.1.1)

A simple bencode decoder and encoder.

Summary

Functions

Takes a bencode string and convert it to a erlang term. Even Erlang specific terms is supported such as atoms and tuples. If Value is an atom() it's considerd to be a file path. If Value is a list() it's considerd to be a bencode string
Encodes the Value provided to bencode

Functions

decode(Value)

-spec decode(Value) -> {ok, Decoded} | {error, Reason} | {warning, Reason, Decoded}
                when
                    Value :: list() | atom(),
                    Decoded :: map() | list() | string() | integer() | atom(),
                    Reason :: atom().
Takes a bencode string and convert it to a erlang term. Even Erlang specific terms is supported such as atoms and tuples. If Value is an atom() it's considerd to be a file path. If Value is a list() it's considerd to be a bencode string

encode(Value)

-spec encode(Value) -> {ok, Encoded} | {error, Reason} | {warning, Reason, Encoded}
                when
                    Value :: map() | list() | string() | integer() | tuple() | atom(),
                    Encoded :: list(),
                    Reason :: atom().
Encodes the Value provided to bencode