magnet-link

1.1.3 • Public • Published

magnet-link

Get a magnet link from a torrent file.

npm travis standard downloads

Read more about the magnet URI scheme at the magnet-uri project website.

Install

npm install magnet-link

Usage

Node

var magnetLink = require('magnet-link')
 
magnetLink('http://my-server.com/file.torrent', function (err, link) {
  if (err) throw err
  console.log(link)
  // you got a magnet link from a remote torrent file
})
 
magnetLink('mydir/file.torrent', function (err, link) {
  if (err) throw err
  console.log(link)
  // you got a magnet link from a local torrent file
})

The result is a string that looks like this.

magnet:?xt=urn:btih:[torrent-info-hash]

CLI

There is also a command-line interface available if you install it with -g.

npm install -g magnet-link

This installs a program called magnet-link that you simply pass a torrent file or url.

magnet-link http://my-server.com/file.torrent

This will print the magnet link to the terminal.

Pipes

You can also pipe the contents of a torrent file to magnet-link:

cat file.torrent | magnet-link
magnet-link < file.torrent

This way it can be paired with create-torrent:

create-torrent . | magnet-link

Contributing

Contributions welcome! Please read the contributing guidelines before getting started.

License

ISC

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.3
    19
    • latest

Version History

Package Sidebar

Install

npm i magnet-link

Weekly Downloads

19

Version

1.1.3

License

ISC

Unpacked Size

6.97 kB

Total Files

6

Last publish

Collaborators

  • ungoldman