Data.Torrent

torrent-10000.0.0: BitTorrent file parser and generater

Safe Haskell | None
Language | Haskell98

Data.Torrent

Synopsis

- data Torrent = Torrent {
  - tAnnounce :: ByteString
  - tAnnounceList :: [ByteString]
  - tComment :: ByteString
  - tCreatedBy :: Maybe ByteString
  - tInfo :: TorrentInfo
  }
- data TorrentInfo
  - = SingleFile {
    - tLength :: Integer
    - tName :: ByteString
    - tPieceLength :: Integer
    - tPieces :: ByteString
    }
  - | MultiFile {
    - tFiles :: [TorrentFile]
    - tName :: ByteString
    - tPieceLength :: Integer
    - tPieces :: ByteString
    }
- data TorrentFile = TorrentFile {
  - fileLength :: Integer
  - filePath :: [ByteString]
  }
- readTorrent :: ByteString -> Either String Torrent
- serializeTorrent :: Torrent -> BEncode
- torrentSize :: Torrent -> Integer

# Documentation

data Torrent

Constructors

Torrent |
Fields tAnnounce :: ByteString tAnnounceList :: [ByteString] tComment :: ByteString tCreatedBy :: Maybe ByteString tInfo :: TorrentInfo

Instances

Data Torrent |
Read Torrent |
Show Torrent |
Binary Torrent |

data TorrentInfo

Constructors

SingleFile |
Fields tLength :: Integer tName :: ByteString tPieceLength :: Integer tPieces :: ByteString
MultiFile |
Fields tFiles :: [TorrentFile] tName :: ByteString tPieceLength :: Integer tPieces :: ByteString

Instances

Data TorrentInfo |
Read TorrentInfo |
Show TorrentInfo |

data TorrentFile

Constructors

TorrentFile |
Fields fileLength :: Integer filePath :: [ByteString]

Instances

Data TorrentFile |
Read TorrentFile |
Show TorrentFile |

readTorrent :: ByteString -> Either String Torrent

serializeTorrent :: Torrent -> BEncode

torrentSize :: Torrent -> Integer

Size of the files in the torrent.