Torrent file

A Torrent file is used by the BitTorrent protocol as a way of helping its users locate a file. BitTorrent is a peer-to-peer network with an ever-changing set of nodes that appear and disappear minute-to-minute as different users start and stop copies of the BitTorrent software. Special nodes called trackers are the point of contact to obtain files shared through the network, though the actual data of the file may be obtained in lots of little pieces spread over many nodes. A torrent file is the first thing you need to obtain before getting a file from BitTorrent; these can be found on many websites.

Torrent files are serialized using the Bencode system, and contain these keys:


 * announce - URL of tracker that knows where to find the file
 * info - Dictionary containing more info about the file:
 * name - Filename/suggested save path
 * piece length - bytes per piece; commonly 262,144 (256K)
 * pieces - Concatenation of SHA-1 hashes of pieces
 * length - File size in bytes, if only one file is being shared
 * files - List of file dictionaries if multiple files are being shared:
 * path - Subdirectory name list; last name is filename
 * length</tt> - File size in bytes.