Portability | portable |
---|---|
Stability | experimental |
Maintainer | pxqr.sta@gmail.com |
Safe Haskell | None |
Torrent file contains metadata about files and folders but not content itself. The files are bencoded dictionaries. There is also other info which is used to help join the swarm.
This module provides torrent metainfo serialization and info hash extraction.
For more info see: http://www.bittorrent.org/beps/bep_0003.html#metainfo-files, https://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure
- data InfoDict = InfoDict {
- idInfoHash :: !InfoHash
- idLayoutInfo :: !LayoutInfo
- idPieceInfo :: !PieceInfo
- idPrivate :: !Bool
- infohash :: Lens' InfoDict InfoHash
- layoutInfo :: Lens' InfoDict LayoutInfo
- pieceInfo :: Lens' InfoDict PieceInfo
- isPrivate :: Lens' InfoDict Bool
- data Torrent = Torrent {
- tAnnounce :: !URI
- tAnnounceList :: !(Maybe [[URI]])
- tComment :: !(Maybe Text)
- tCreatedBy :: !(Maybe Text)
- tCreationDate :: !(Maybe POSIXTime)
- tEncoding :: !(Maybe Text)
- tInfoDict :: !InfoDict
- tPublisher :: !(Maybe URI)
- tPublisherURL :: !(Maybe URI)
- tSignature :: !(Maybe BS.ByteString)
- announce :: Lens' Torrent URI
- announceList :: Lens' Torrent (Maybe [[URI]])
- comment :: Lens' Torrent (Maybe Text)
- createdBy :: Lens' Torrent (Maybe Text)
- creationDate :: Lens' Torrent (Maybe POSIXTime)
- encoding :: Lens' Torrent (Maybe Text)
- infoDict :: Lens' Torrent InfoDict
- publisher :: Lens' Torrent (Maybe URI)
- publisherURL :: Lens' Torrent (Maybe URI)
- signature :: Lens' Torrent (Maybe BS.ByteString)
- nullTorrent :: URI -> InfoDict -> Torrent
- torrentExt :: String
- isTorrentPath :: FilePath -> Bool
- fromFile :: FilePath -> IO Torrent
- toFile :: FilePath -> Torrent -> IO ()
Info dictionary
Info part of the .torrent file contain info about each content file.
InfoDict | |
|
Lenses
Torrent file
Metainfo about particular torrent.
Torrent | |
|
Lenses
Construction
nullTorrent :: URI -> InfoDict -> TorrentSource
A simple torrent contains only required fields.
File paths
Extension usually used for torrent metafiles.
isTorrentPath :: FilePath -> BoolSource
Test if this path has proper extension.