Packages
A complete and correct Bencode encoder and decoder written in pure Elixir. The decoder will return the info hash with along with the decoded data, and the encoder is implemented as a protocol, allowing any data structure to be bcode encoded.
Current section
Files
Jump to
Current section
Files
lib/bencode.ex
defmodule Bencode do
@spec encode(any) :: String.t
defdelegate encode(data),
to: Bencode.Encoder
@spec decode(String.t) :: {:ok, Integer | String.t | List | Map | no_return, nil | binary}
defdelegate decode(data),
to: Bencode.Decoder
@spec decode!(String.t) :: Integer | String.t | List | Map | no_return
defdelegate decode!(data),
to: Bencode.Decoder
end