How to use the magnet-uri.encode function in magnet-uri

To help you get started, we’ve selected a few magnet-uri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / magnet-uri / magnet-uri-tests.ts View on Github external
import * as magnet from 'magnet-uri';

// "Leaves of Grass" by Walt Whitman
// tslint:disable-next-line:max-line-length
const uri = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.example4.com%3A80&tr=udp%3A%2F%2Ftracker.example5.com%3A80&tr=udp%3A%2F%2Ftracker.example3.com%3A6969&tr=udp%3A%2F%2Ftracker.example2.com%3A80&tr=udp%3A%2F%2Ftracker.example1.com%3A1337';

const parsed = magnet.decode(uri);
console.log(parsed);
console.log(magnet.encode(parsed));

magnet-uri

Parse a magnet URI and return an object of keys/values

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Popular magnet-uri functions