npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mega-torrent

v1.2.10

Published

Download torrent directly to your mega account

Downloads

54

Readme

Mega-Torrent

build-badge

Installation

$ npm install mega-torrent

var Mega_Torrent = require('mega-torrent')

Usage exemple

myapp.js:

var Mega_Torrent = require('../src/index.js')
var mega_t = new Mega_Torrent({
  email: "myemail@gmail.com",
  password: "******"
})

var url = "magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4"
mega_t.download(url)

setInterval(function(){
  var client = mega_t.getClients()[url]
  var mega = mega_t.getMegas()[url]
  if(client){
    console.log("Download progress: ", Math.round(client.getProgress() * 100), "%")
  }
  if(mega){
    console.log("Upload progress: ", Math.round(mega.getProgress() * 100), "%")
  }
}, 500)

API

Main Module

var mega_t = new Mega_Torrent([options])

Create new torrent downloader.

Supporter options:

email - User login email (Require) password - User password (Require)

mega_t.download(Torrent)

Start downloading a torrent.

Torrent can be:

• magnet uri (string) • torrent file (buffer) • info hash (hex string or buffer) • parsed torrent (from parse-torrent) • http/https url to a torrent file (string) • filesystem path to a torrent file (string)

mega_t.getStatus()

Return the current status of the Mega_Torrent instance.

Code:

• 0 - Doing nothing • 1 - Downloading the Torrent • 2 - Uploading the Torrent

mega_t.getMegas()

Return running uploading instances. (aka megas)

mega_t.getClients()

Return running downloading instances. (aka clients)

Megas

Instance of current uploading file to MEGA.

megas.getStream()

Return Node stream instance.

megas.getProgress()

Return the current upload percentage. (between 0 and 1)

megas.getFile()

Return Node fs stats instance.

Clients

Instance of downloading torrent client.

clients.stop()

Stop and destroy the current downloading torrent.

clients.getProgress()

Return the current download percentage. (between 0 and 1)

clients.getTorrent()

Return WebTorrent torrent instance.