Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Torrent
Description
BitTorrent metainfo files
Synopsis
- data Torrent = Torrent {}
- data TorrentInfo
- = SingleFile { }
- | 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
- showTorrent :: Torrent -> ByteString
Documentation
Constructors
Torrent | |
Fields
|
Instances
Binary Torrent # | |
Data Torrent # | |
Defined in 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 :: forall r r'. (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 # | |
Show Torrent # | |
data TorrentInfo #
Constructors
SingleFile | |
Fields
| |
MultiFile | |
Fields
|
Instances
Data TorrentInfo # | |
Defined in Data.Torrent 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 :: forall r r'. (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 # | |
Defined in Data.Torrent Methods readsPrec :: Int -> ReadS TorrentInfo # readList :: ReadS [TorrentInfo] # readPrec :: ReadPrec TorrentInfo # readListPrec :: ReadPrec [TorrentInfo] # | |
Show TorrentInfo # | |
Defined in Data.Torrent Methods showsPrec :: Int -> TorrentInfo -> ShowS # show :: TorrentInfo -> String # showList :: [TorrentInfo] -> ShowS # |
data TorrentFile #
Constructors
TorrentFile | |
Fields
|
Instances
Data TorrentFile # | |
Defined in Data.Torrent 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 :: forall r r'. (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 # | |
Defined in Data.Torrent Methods readsPrec :: Int -> ReadS TorrentFile # readList :: ReadS [TorrentFile] # readPrec :: ReadPrec TorrentFile # readListPrec :: ReadPrec [TorrentFile] # | |
Show TorrentFile # | |
Defined in Data.Torrent 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.
showTorrent :: Torrent -> ByteString #
generates a torrent file
Due to lexographical ordering requirements of BEncoded data, this should generate the same ByteString that readTorrent read to generate the Torrent. However, torrent files may contain extensions and nonstandard fields that prevent that from holding for all torrent files.