A Node.js utility for creating and parsing torrent files.
- Create Torrent Files: Generate .torrent files from any file
- Generate Magnet Links: Automatically create magnet URIs for torrents
- Parse Torrent Files: Read and extract information from existing .torrent files
- Outputs to organized directories (
out/torrent,out/magnet,out/json,out/txt)
npm installUse exec.js to create a .torrent file and magnet link from any file:
node src/exec.js --file <path-to-file> --name <torrent-name>Example:
node src/exec.js --file package.json --name my-packageOutput:
- ✅
.torrentfile saved toout/torrent/<torrent-name>.torrent - 🧲 Magnet link saved to
out/magnet/<torrent-name>.txt - 📺 Magnet link displayed in console for easy copying
Example Output:
✅ Torrent created successfully!
📁 Torrent file: out/torrent/my-package.torrent
🧲 Magnet link: magnet:?xt=urn:btih:...&dn=my-package&tr=udp://tracker.opentrackr.org:1337/announce&tr=...
💾 Magnet saved to: out/magnet/my-package.txt
Trackers used:
udp://tracker.opentrackr.org:1337/announceudp://open.tracker.cl:1337/announceudp://open.demonii.com:1337/announceudp://open.stealth.si:80/announceudp://tracker.torrent.eu.org:451/announceudp://exodus.desync.com:6969/announceudp://tracker.tiny-vps.com:6969/announce
Use read.js to read and parse an existing .torrent file:
node src/read.js --torrent <path-to-torrent-file>Example:
node src/read.js --torrent out/torrent/package.torrentThis will:
- Output torrent metadata as JSON to
out/json/<torrent-name>.json - Output piece hashes to
out/txt/<torrent-name> - Display torrent information in the console
out/
├── torrent/ # Generated .torrent files
├── magnet/ # Magnet links (text files)
├── json/ # Parsed torrent metadata (JSON)
└── txt/ # Piece hashes (text)
create-torrent- Create torrent filesparse-torrent- Parse torrent filesbencode- Bencode encoding/decoding for torrent filescommander- CLI argument parsing
ISC