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 # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Torrent -> c Torrent # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Torrent # toConstr :: Torrent -> Constr # dataTypeOf :: Torrent -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Torrent) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Torrent) # gmapT :: (forall b. Data b => b -> b) -> Torrent -> Torrent # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Torrent -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Torrent -> r # gmapQ :: (forall d. Data d => d -> u) -> Torrent -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Torrent -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Torrent -> m Torrent # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Torrent -> m Torrent # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Torrent -> m Torrent #
Read Torrent # |
Methods readsPrec :: Int -> ReadS Torrent # readList :: ReadS [Torrent] # readPrec :: ReadPrec Torrent # readListPrec :: ReadPrec [Torrent] #
Show Torrent # |
Methods showsPrec :: Int -> Torrent -> ShowS # show :: Torrent -> String # showList :: [Torrent] -> ShowS #
Binary Torrent # |
Methods put :: Torrent -> Put # get :: Get Torrent # putList :: [Torrent] -> Put #

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 # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TorrentInfo -> c TorrentInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TorrentInfo # toConstr :: TorrentInfo -> Constr # dataTypeOf :: TorrentInfo -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TorrentInfo) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TorrentInfo) # gmapT :: (forall b. Data b => b -> b) -> TorrentInfo -> TorrentInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TorrentInfo -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TorrentInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> TorrentInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TorrentInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TorrentInfo -> m TorrentInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TorrentInfo -> m TorrentInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TorrentInfo -> m TorrentInfo #
Read TorrentInfo # |
Methods readsPrec :: Int -> ReadS TorrentInfo # readList :: ReadS [TorrentInfo] # readPrec :: ReadPrec TorrentInfo # readListPrec :: ReadPrec [TorrentInfo] #
Show TorrentInfo # |
Methods showsPrec :: Int -> TorrentInfo -> ShowS # show :: TorrentInfo -> String # showList :: [TorrentInfo] -> ShowS #

data TorrentFile #

Constructors

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

Instances

Data TorrentFile # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TorrentFile -> c TorrentFile # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TorrentFile # toConstr :: TorrentFile -> Constr # dataTypeOf :: TorrentFile -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TorrentFile) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TorrentFile) # gmapT :: (forall b. Data b => b -> b) -> TorrentFile -> TorrentFile # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TorrentFile -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TorrentFile -> r # gmapQ :: (forall d. Data d => d -> u) -> TorrentFile -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TorrentFile -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TorrentFile -> m TorrentFile # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TorrentFile -> m TorrentFile # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TorrentFile -> m TorrentFile #
Read TorrentFile # |
Methods readsPrec :: Int -> ReadS TorrentFile # readList :: ReadS [TorrentFile] # readPrec :: ReadPrec TorrentFile # readListPrec :: ReadPrec [TorrentFile] #
Show TorrentFile # |
Methods showsPrec :: Int -> TorrentFile -> ShowS # show :: TorrentFile -> String # showList :: [TorrentFile] -> ShowS #

readTorrent :: ByteString -> Either String Torrent #

serializeTorrent :: Torrent -> BEncode #

torrentSize :: Torrent -> Integer #

Size of the files in the torrent.