Magnetizer

Library for decoding and encoding magnet links
Fast and easy to use
Written in TypeScript
Fully tested with 100% code coverage
Installation
npm install --save magnetizer
Getting Started
Decode magnet link
import magnetizer from 'magnetizer';
const magnetUri = magnetizer.decode(magnetLink);
Encode magnet link
import magnetizer from 'magnetizer';
const magnetLink = magnetizer.encode({
displayName: 'test-name_for_magnet-link.tar.gz',
length: 100500,
infoHashes: [ 'c12fe1c06bba254a9dc9f519b335aa7c1367a88a' ],
webSeeds: [ 'http://example.com/test-name_for_magnet-link.tar.gz' ],
acceptableSources: [ 'http://example.com/test-name_for_magnet-link.tar.gz' ],
sources: [ 'http://cache.example.com/c12fe1c06bba254a9dc9f519b335aa7c1367a88a' ],
keywords: [ 'test-name_for_magnet-link', 'tar', 'gz' ],
manifest: 'http://example.com/manifest',
trackers: [
'http://tracker.example.com/announce.php?ua=1111111111',
'wss://tracker.webtorrent.io',
],
});
Tests
npm test
License
This project is licensed under the MIT License - see the LICENSE file for details.