rgrinberg / bencode

Bencode (.torrent file format) reader/writer in OCaml
24 stars 4 forks source link

bencode Build Status

Bencode (.torrent file format) reader/writer in OCaml without any external dependencies.

See lib/bencode.mli. Usage is straightforward. There is also a streaming API in modules Bencode_streaming and Bencode_token.

online documentation here

Installation

For a findlib based install

make
make install

Example

In the top level:

#require "bencode"
Bencode.decode (`File_path "test.torrent")

Will return a data structure representing the bencoded form of the following type:

type t =
  | Integer of int64
  | String of string
  | List of t list
  | Dict of (string * t) list