In this article, we will discuss about .torrent file. It is difficult to view to contents of a .torrent file using conventional document or text manipulation software like Microsoft Word and Notepad, so we use Torrent File Editor software for Windows Operating System to see the contents.
According to Wikipedia, a torrent file is a bencoded dictionary with the following keys (the keys in any bencoded dictionary are lexicographically ordered). This file contains metadata that helps to download another file/folder to which it is associated. The file is in a dictionary form. Below is a screenshot to demonstrate the raw content of a torrent file.
Also, have a look at the tree view of the torrent file for better understandability.
See the dictionary format of the above file content. We will discuss the highlighted fields of the first screenshot.
announce: The announce field points to the tracker of the content file(s) that we are uploading as a torrent. This is a ‘UDP tracker protocol’. Note that the above value of ‘announce’ is of the form
udp://exampletracker.com:port. This syntax might change depending on different torrent clients and different tracker providers.
What is a tracker?: As the name suggests, it helps peers to find each other on the network. When a node wants to download a torrent file, the tracker responds with the list of nodes that have the desired file and also, registers the requesting node for other nodes to see.
comment: Comment about the torrent file added by the creator of the torrent. See below to know how they are added at the creation of a torrent.
created by: Creater of the torrent. A string type.
creation date: Timestamp in seconds. For example, the timestamp in the top image converts to
Tuesday, December 3, 2019 8:51:22 PM GMT+05:30
info: Contains length and path of file(s) as separate objects; one for each file.
info.files[i].length: Length of the file in Bytes.
info.files[i].path: An array of strings which denotes the subdirectory names.
name: Name of the torrent file.
piece length: It denotes the length of one piece, generally 28KB.
pieces: It denotes each piece’s SHA-1 hash, stored in a hash list. Its always a multiple of 160-bits as output of SHA-1 is 160-bits. In UTF-8 encoding, it is something like this(totally unreadable).
- What is a Torrent?
- Python program to reverse the content of a file and store it in another file
- Automating File Movement on your system
- Junk File Organizer in Python
- File Allocation Methods
- How to play an Audio file using Java
- Reading and Writing data to excel file using Apache POI
- Difference between FAT32, exFAT, and NTFS File System
- The Application Manifest File | Android
- File uploading in Node.js
- Python | file parameter in print()
- Creating a Cell at specific position in Excel file using Java
- Reading a CSV file in Java using OpenCSV
- Creating Sheets in Excel File in Java using Apache POI
- How to refresh a file in Node.js ?
- Convert byte array to File using Java
- Sorting integer data from file and calculate execution time
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.