magnetizer
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Magnetizer

ci Coverage Status NPM Downloads NPM License

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.

Package Sidebar

Install

npm i magnetizer

Weekly Downloads

3

Version

2.0.2

License

MIT

Unpacked Size

20.8 kB

Total Files

11

Last publish

Collaborators

  • isolomak