bento v0.9.0 Bento
Summary
Functions
Decode bencoded data to a value
Decode bencoded data to a value, raises an exception on error
Bencode a value
Bencode a value, raises an exception on error
Like decode, but ensures the data is a valid torrent metainfo file
Like decode!, but ensures the data is a valid torrent metainfo file
Functions
Specs
decode(iodata, Keyword.t) ::
{:ok, Bento.Parser.t} |
{:error, :invalid} |
{:error, {:invalid, String.t}}
Decode bencoded data to a value.
iex> Bento.decode("li1e3:twoli3eee")
{:ok, [1, "two", [3]]}
Specs
decode!(iodata, Keyword.t) ::
Bento.Parser.t |
no_return
Decode bencoded data to a value, raises an exception on error.
iex> Bento.decode!("li1e3:twoli3eee")
[1, "two", [3]]
Specs
encode(Bento.Encoder.t, Keyword.t) ::
{:ok, iodata} |
{:ok, String.t} |
{:error, {:invalid, any}}
Bencode a value.
iex> Bento.encode([1, "two", [3]])
{:ok, "li1e3:twoli3eee"}
Specs
encode!(Bento.Encoder.t, Keyword.t) ::
iodata |
no_return
Bencode a value, raises an exception on error.
iex> Bento.encode!([1, "two", [3]])
"li1e3:twoli3eee"