Coder Social home page Coder Social logo

mega-torrent's Introduction

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: "[email protected]",
  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.

mega-torrent's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mega-torrent's Issues

Heroku ?

hi i just used your lunik torrent and it was amazing,
i want to know that is this app is compatible with heroku or not.

Torrent Does not download to mega

  1. Download the npm
  2. Follow the standard procedures to edit the file, with username, password and magnet link.
  3. Run the js.
  4. It keeps showing Download progress: 0%
  5. This issue is replicable with all the working torrent magnetic links,

An in-range update of webtorrent is breaking the build 🚨

Version 0.98.1 of webtorrent just got published.

Branch Build failing 🚨
Dependency webtorrent
Current Version 0.98.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As webtorrent is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 17 commits .

  • 43c268c AUTHORS
  • ad8e931 build
  • 482f433 0.98.1
  • e57f82f Merge pull request #1012 from kocoten1992/patch-1
  • f299444 docs: clarify wording
  • 5400494 Until it is fixed, let notify webtorrent user
  • 4c09ab6 added BitChute to the app list (#1009)
  • 8045540 faq: add source code links
  • 0d5dc9f Merge pull request #1001 from Lunik/master
  • f5808aa Show demo instead of github repo
  • bc7bde2 Add new WebTorrent app: Lunik-Torrent
  • 7cc19bb Merge pull request #997 from ronsoros/patch-1
  • c850448 Add new WebTorrent based product: CodeDump
  • e2cab6e Add WebTorrent Player (#992)
  • 8b36544 Merge pull request #989 from FluorescentHallucinogen/patch-1

There are 17 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

RangeError after download and befor starting to upload

Download progress:  100 %
Download progress:  100 %
internal/buffer.js:49
  throw new ERR_OUT_OF_RANGE(type || 'offset',
  ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 6. Received 8
    at boundsError (internal/buffer.js:49:9)
    at Buffer.readInt32BE (internal/buffer.js:361:5)
    at Object.exports.prepareKey (/node_modules/mega/lib/crypto/index.js:35:24)
    at new Storage (/node_modules/mega/lib/storage.js:75:21)
    at mega (/node_modules/mega/lib/mega.js:9:10)
    at new Mega (/node_modules/mega-torrent/src/mega.js:6:18)
    at /node_modules/mega-torrent/src/index.js:20:17
    at Array.forEach (<anonymous>)
    at /node_modules/mega-torrent/src/index.js:19:21
    at Torrent.<anonymous> (/node_modules/mega-torrent/src/client.js:16:9)

does this work in Sep-2022?

the last update on repo was done 6 years ago. so, as the title says, does this npm package work in Sep-2022?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.