download torrents with node from the CLI

Related tags

Command Line torrent
Overview

torrent

NPM

Download torrents from the command line

usage

torrent <magnet link OR path to .torrent file>

  Download a torrent from a magnet link to torrent file.

torrent create <directory OR file> {-o outfile.torrent}

  Create a torrent file from a directory or file.

  If an output file isn't specified with `-o`, the torrent file will be
  written to stdout.

torrent seed <torrent file>

  Seed a torrent file.

torrent info <torrent file>

  Print information about a .torrent file to stdout as JSON.

torrent ls OPTIONS <torrent file>

  List all the files in a .torrent file.

  OPTIONS are like the `ls` command:

    -s  Show file sizes in bytes alongside file paths.
    -h  Show file sizes in human units when `-s` is on.

download a torrent

e.g. to download ubuntu 14.04 ISO

torrent "magnet:?xt=urn:btih:4d753474429d817b80ff9e0c441ca660ec5d2450&dn=Ubuntu+14.04+64+bit&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Fopen.demonii.com%3A1337"

or via .torrent file:

torrent ubuntu-14.04.iso.torrent

it will print progress:

$ torrent ubuntu-14.04.iso.torrent
1 file(s) in torrent
ubuntu-14.04.iso
Connected to 35/37 peers
Downloaded 5.47 MB (1.09 MB/s) with 0 hotswaps
Uploaded 0 B (0 B/s)

create a torrent

You can create a torrent file with torrent create:

mkdir xyz; echo beep > xyz/a.txt; echo boop > xyz/b.txt
torrent create xyz/ -o xyz.torrent
Comments
  • Ctrl+C doesn't stop the process. Its only killed by Ctrl+D

    Ctrl+C doesn't stop the process. Its only killed by Ctrl+D

    There is no method to stop the download process in the middle except by using Ctrl+D, Ctrl+C somehow fails to stop the process. On pressing Ctrl+C, The terminal returns to

    $
    

    and quickly jumps back to something like

    Connected to 1/44 peers
    Connected to 1/47 peers
    

    and continues the download

    Mac OS X Mavericks

    opened by sudheesh001 9
  • Support for a torrent URL in lieu of a magnet link or .torrent file

    Support for a torrent URL in lieu of a magnet link or .torrent file

    It would be swell if I could run a command like

    torrent "http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso.torrent"
    

    and have it grab the torrent file and act as though I had passed in the torrent locally.

    opened by hackergrrl 5
  • accept torrent file from stdin

    accept torrent file from stdin

    This accepts a torrent-file from stdin downloading or seeding. Before, this was already possible with the info and ls command, this extends this support to cover all operations.

    The dependency on parse-torrent has been bumped to a version that actually throws errors. It was previously wrapped in a try catch even though it returned null instead of throwing an error.

    opened by LinusU 4
  • `torrent {create,ls,info}` commands

    `torrent {create,ls,info}` commands

    This command uses create-torrent to create torrent files. If you want to create a torrent file for a directory xyz/, you can just do:

    torrent create xyz/ -o xyz.torrent
    

    If -o isn't specified, the torrent file is written to stdout. I also added a usage.txt that is displayed when you torrent --help.

    opened by ghost 4
  • only check for .torrent if the the path doesn't start with magnet:

    only check for .torrent if the the path doesn't start with magnet:

    Some magnet links might have .torrent in their URL for other reasons than being a .torrent file on disk.

    Before this patch:

    $ torrent 'magnet:?xt=urn:btih:77e1a18941186c1e6441721df91183d2a339d103&dn=Citizenfour%5FEdward-Snowden%5FLaura-Poitras&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=http%3A%2F%2Fannounce.torrentsmd.com%3A8080%2Fannounce.php'
    
    fs.js:439
      return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                     ^
    Error: ENAMETOOLONG, name too long 'magnet:?xt=urn:btih:77e1a18941186c1e6441721df91183d2a339d103&dn=Citizenfour%5FEdward-Snowden%5FLaura-Poitras&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=http%3A%2F%2Fannounce.torrentsmd.com%3A8080%2Fannounce.php'
        at Object.fs.openSync (fs.js:439:18)
        at Object.fs.readFileSync (fs.js:290:15)
        at Object.<anonymous> (/home/substack/projects/torrent/cli.js:116:52)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Function.Module.runMain (module.js:497:10)
        at startup (node.js:119:16)
        at node.js:929:3
    

    After this patch:

    $ torrent 'magnet:?xt=urn:btih:77e1a18941186c1e6441721df91183d2a339d103&dn=Citizenfour%5FEdward-Snowden%5FLaura-Poitras&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=http%3A%2F%2Fannounce.torrentsmd.com%3A8080%2Fannounce.php'
    2 files in torrent
    Citizenfour_Edward-Snowden_Laura-Poitras.mp4
    README.txt
    Connected to 19/35 peers
    Downloaded 18.69 MB (1.17 MB/s)
    Uploaded 0 B (0 B/s)
    Torrent Size 3.64 GB
    
    Complete: 0.5138%
    [                    ]
    0%    25   50   75   100%
    
    Estimated 1 hour, 9 minutes and 44 seconds remaining
    
    opened by ghost 2
  • Adds estimated time remaining to console log

    Adds estimated time remaining to console log

    Adds an estimated time remaining to console log. The algorithm goes something like this: (TimeTaken / bytesDownloaded) * bytesLeft = timeLeft

    It seems to work pretty well.

    opened by mgrigajtis 2
  • Notification

    Notification

    Hi there!

    I wonder if there is a way to make any notification on torrent finishing the download, or maybe an option to quit program after download is complete.

    Thank you in advance!

    opened by DKunin 1
  • Bump torrent-stream version to address security vulnerability

    Bump torrent-stream version to address security vulnerability

    Running npm i on master yields:

    [email protected]: Critical security issue fixed in 5.1.3. 
    All users should upgrade. (More info: https://github.com/feross/bittorrent-dht/issues/87)
    

    This PR bumps torrent-stream version to address this security issue.

    opened by zmackie 1
  • Update package.json

    Update package.json

    Bump for the torrent deps following the recommendation here https://github.com/feross/create-torrent/issues/10

    Because of this fix https://github.com/feross/parse-torrent-file/commit/8a442364fef4a9c6bc10707262988129c32ce12c

    opened by No9 1
  • Seed infile fix

    Seed infile fix

    The seed logic was passing source previously, which was just the literal string "seed". This patch fixes torrent seed to use infile instead.

    $ torrent seed auckland.torrent 
    /home/substack/projects/torrent/node_modules/torrent-stream/index.js:69
        if (!link || !link.infoHash) throw new Error('You must pass a valid torrent o
                                           ^
    Error: You must pass a valid torrent or magnet link
        at torrentStream (/home/substack/projects/torrent/node_modules/torrent-stream/index.js:69:37)
        at module.exports (/home/substack/projects/torrent/index.js:6:16)
        at Object.<anonymous> (/home/substack/projects/torrent/cli.js:112:12)
        at Module._compile (module.js:460:26)
        at Object.Module._extensions..js (module.js:478:10)
        at Module.load (module.js:355:32)
        at Function.Module._load (module.js:310:12)
        at Function.Module.runMain (module.js:501:10)
        at startup (node.js:129:16)
        at node.js:814:3
    
    opened by ghost 1
  • Fixes syntax errors and adds percent downloaded

    Fixes syntax errors and adds percent downloaded

    Fixes syntax errors that my JavaScript linter caught. But more importantly, it adds total bytes of the torrent being downloaded, and calculates percent complete.

    opened by mgrigajtis 1
  • DeprecationWarning error

    DeprecationWarning error

    I was doing the NodeSchool's tutorial "torrential", which uses this library, but a DeprecationWarning error occurred when I was creating a torrent file of a folder of two .txt documents.

    I retried multiple times. I am on Windows10 with Node.js v8.9.1.

    Here is a screenshot of the error:

    deprecationwarning error

    opened by joao-neves95 2
  • subcommands ls, info, seed do not support magnet links

    subcommands ls, info, seed do not support magnet links

    According to torrent --help:

    Commands:
    
    torrent            <torrent>
    torrent seed       <torrent>
    torrent info       <torrent>
    torrent ls         <torrent>
    torrent create     <directory OR file> {-o outfile.torrent}
    
    `<torrent>` above can be a magnet link, a path to .torrent file or `-` for STDIN
    

    However, supplying a magnet link for seed, info, or ls produces errors.

    opened by hackergrrl 0
  • Amount Downloaded from Each Peer

    Amount Downloaded from Each Peer

    Hi @maxogden, I really liked using this module. I would like to know if there is a way to list the amount of file downloaded from each peer, using this module.

    So far. I did not find anything in the README itself.

    Or, is it something the bittorrent tracker server or dht would provide?

    opened by alayek 3
  • I have this error

    I have this error

    Connected to 6/7 peers
    Downloaded 432.73 kB (133.15 kB/s)
    Uploaded 0 B (0 B/s)
    Torrent Size 399.96 kB
    
    Complete: 100%
    [=====================]
    0%    25   50   75   100%
    
    Estimated  remaining
    /usr/local/lib/node_modules/torrent/cli.js:186
            progressBar = progressBar + Array(20 + 1 - progressBar.length).join(' ')
                                        ^
    
    RangeError: Invalid array length
        at status [as _repeat] (/usr/local/lib/node_modules/torrent/cli.js:186:37)
        at wrapper [as _onTimeout] (timers.js:264:19)
        at Timer.listOnTimeout (timers.js:92:15)
    
    opened by emmtte 0
Pretty diff to html javascript cli (diff2html-cli)

diff2html-cli Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal Table of Contents Features Online Example Dis

Rodrigo Fernandes 404 Dec 19, 2022
LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI.

LinkFree CLI LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI. Demo Using the CLI (Commands) Note First

Pradumna Saraf 32 Dec 26, 2022
Distributed, realtime CLI for live Node apps.

Vantage = CLI + SSH + REPL for your live node app. In one line: require("vantage")().listen(4000); What just happened? That's voodoo magic: show me th

dc 3.5k Dec 30, 2022
Node.js Open CLI Framework. Built with 💜 by Heroku.

oclif: Node.JS Open CLI Framework ?? Description ?? Getting Started Tutorial ✨ Features ?? Requirements ?? CLI Types ?? Usage ?? Examples ?? Commands

oclif 8k Jan 4, 2023
Node.js CLI tool to generate a set of favicons from a single input file.

This is a simple CLI tool to generate an optimized set of favicons from a single input file. Icons are optimized in terms of both size and quantity (n

null 6 Nov 11, 2022
Infinite Red's cutting edge React Native project boilerplate, along with a CLI, component/model generators, and more!

Ignite - the hottest React Native boilerplate Battle-tested React Native boilerplate The culmination of five years of constant React Native developmen

Infinite Red, Inc. 14.7k Dec 29, 2022
CLI tool for running Yeoman generators

yo What's Yeoman? Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive. To do so, we provide a

Yeoman 3.6k Dec 30, 2022
Test your internet connection speed and ping using speedtest.net from the CLI

speed-test Test your internet connection speed and ping using speedtest.net from the CLI Install Ensure you have Node.js version 8+ installed. Then ru

Sindre Sorhus 3.8k Jan 7, 2023
:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer

Whatspup Use Whatsapp from commandline/console/cli using GoogleChrome puppeteer! ?? Features ✅ Send and receive messages ✅ Read Receipts ✅ Switch betw

Sarfraz Ahmed 343 Dec 1, 2022
:notes: Control iTunes via CLI

itunes-remote Control iTunes via your terminal ?? Using JXA via osascript via Node.js. Requirements Node.js (v0.12.7 or greater) Mac OS X (Yosemite 10

Michael Kühnel 422 Nov 19, 2022
Add stdin support to any CLI app that accepts file input

tmpin Add stdin support to any CLI app that accepts file input It pipes stdin to a temp file and spawns the chosen app with the temp file path as the

Sindre Sorhus 121 Oct 3, 2022
A CLI for peer-to-peer file sharing using the Hypercore Protocol.

A CLI for peer-to-peer file sharing (and more) using the Hypercore Protocol.

Hypercore Protocol 207 Dec 30, 2022
Git commit CLI

commitme Based on this gist by @gustavopch Installation You can install this on your package using npm i -D commitme or run it once using npx commitme

Roz 7 Jun 6, 2021
An extension geared towards Spotify users with larger libraries; view all your playlists that contain a specific song with the click of a button. Designed for Spicetify (https://github.com/khanhas/spicetify-cli)

ViewPlaylistsWithSong An extension developed for Spicetify that allows you to view all the playlists in your library that contain a certain song. Idea

null 21 Dec 13, 2022
HMSC (How Much Stuffs CLI) analyst for your files and folders

HMSC ?? About HMSC (How Much Stuffs CLI) analyst for your files and folders ?? Screenshot ?? Requirements Node.js NPM ?? Installation $ npm i -g hmsc

Abdullah Veliyev 26 Jan 10, 2022
A C++ based command-line (CLI) program that lets you manage your tasks

COMMAND LINE INTERFACE TODO APP a command-line (CLI) program that lets you manage your tasks. The specification for this project is written down as te

Rahul Prabhakar 1 Dec 25, 2021
A CLI progam show teminal outputs as gradients.

GRADIENT-TERMINAL A CLI progam to display teminal outputs as gradients. Requirements For Installation, you will only need Node.js. Install $ git clone

Ritin George 34 Jan 3, 2023
Tasks Management CLI application with Nodejs, Mongodb, inquirer.js, and commander

Tasks CLI Tasks CLI is a program to manage your tasks in a database using terminal or console. This is a sample project for beginners Requirements Nod

Fazt Web 9 Nov 17, 2022