Parse magnet URIs into structured objects and encode objects back into magnet URIs for BitTorrent applications.
magnet-uri is a JavaScript library that parses magnet URIs into structured JavaScript objects and encodes objects back into magnet URI strings. It solves the problem of extracting and manipulating metadata from magnet links, which are commonly used in BitTorrent and peer-to-peer file sharing networks.
Developers building BitTorrent clients, peer-to-peer applications, or tools that need to process magnet links, particularly those using the WebTorrent ecosystem.
Developers choose magnet-uri for its simplicity, reliability, and seamless integration with WebTorrent, providing a standardized way to handle magnet URIs across both Node.js and browser environments.
Parse a magnet URI and return an object of keys/values
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Decodes magnet URIs into structured objects with normalized keys, ensuring reliable extraction of metadata like info hashes and tracker URLs, as shown in the decode example with exact key mapping.
Provides human-readable properties such as infoHash, name, and announce alongside standard keys like xt and dn, simplifying code readability and reducing manual mapping efforts.
Works in both Node.js and browser environments when bundled with Browserify, enabling consistent magnet URI handling across different platforms, as stated in the README.
Supports various hash types including BTIH, ED2K, and TigerTree within the same URI, accommodating diverse peer-to-peer standards, demonstrated in the encode example with multiple xt values.
Requires Browserify for browser use, adding setup complexity and bundle overhead compared to standalone browser libraries, limiting ease of integration in lightweight web projects.
Focused solely on magnet URIs, lacking features for parsing torrent files or other P2P metadata formats, which may necessitate additional libraries for comprehensive torrent handling.
The README doesn't detail error handling for malformed URIs or edge cases, leaving developers to implement their own validation and potentially face debugging challenges.