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 🙏

© 2024 – Pkg Stats / Ryan Hefner

library-utorrent

v1.1.0

Published

Communicate with uTorrent client API to list and add torrents.

Downloads

45

Readme

library-utorrent

Communicate with uTorrent Web API to list and add torrents, wraps the uTorrent Web API: http://help.utorrent.com/customer/portal/topics/664593/articles

Installation

$ npm install library-utorrent --save

Usage

Load the library:

var UTorrent = require('library-utorrent');

Add a Torrent file:

UTorrent.addTorrent({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345',
  torrentContents: fileBufferWithTorrentContent,
  downloadDir: 0,
  path: '/dir/path/',
}).exec({
  // An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (){

  }
});

Add a Torrent url:

UTorrent.addTorrentUrl({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345',
  torrentUrl: urlOrMagnet,
  downloadDir: 0,
  path: '/dir/path/',
}).exec({
  // An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (){

  }
});

List all Torrents and details:

UTorrent.listTorrents({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345',
}).exec({
// An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (torrents){
    /*
    torrents is an array of objects:
    [{
      parsed: {
        hash,
        name,
        size
        percentProgressMils,
        downloadedBytes,
        uploadedBytes,
        ratioMils,
        uploadspeedBytesSec,
        downloadspeedBytesSec,
        etaSec,
        peersConnected,
        peersSwarm,
        seedsConnected,
        seedsSwarm,
        availability,
        queueOrder,
        remainingBytes,
        torrentUrl,
        status,
        downloadDir
      },
      raw
    }, ...]
    */
  }
});

List Torrent Contents:

UTorrent.getTorrentDetails({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345',
  hash: 'torrentHash'
}).exec({
// An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (result){
    /*
    {
      "build": BUILD NUMBER (integer),
      "files": [
      HASH (string),
      [
      [
      FILE NAME (string),
      FILE SIZE (integer in bytes),
      DOWNLOADED (integer in bytes),
      PRIORITY* (integer)	],
      ...
      ]
      ]
    }
    */
  }
});

Remove, start and stop torrent:

UTorrent.removeTorrent({...credentials, hash: 'torrentHash'}) // remove or removedata (with param removedata=true)
UTorrent.startTorrent({...credentials, hash: 'torrentHash'}) // start or forcestart (with param force=true)
UTorrent.stopTorrent({...credentials, hash: 'torrentHash'})

Retrieve uTorrent settings:

UTorrent.getsettings({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345'
}).exec({
  // An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (result){
    /*
    {
      "build": BUILD NUMBER (integer),
      "settings": [
      [
      OPTION NAME (string),
      TYPE* (integer),
      VALUE (string)	],
      ...
      ]
    }
    */
  }
});
  • OPTION NAME is the name of the setting. They are not listed here, as some of the settings (particularly advanced ones) vary with each version and most are self-explanatory
  • TYPE is an integer value that indicates what type of data is enclosed within the VALUE string. The following is a list of the possible TYPEs and what VALUE type it corresponds to:
    • 0 = Integer
    • 1 = Boolean
    • 2 = String

Set uTorrent settings:

UTorrent.setSettings({
  host: 'localhost',
  port: 26085,
  username: 'admin',
  password: '12345',
  name: settingName,
  value: settingValue
}).exec({
  // An unexpected error occurred.
  error: function (err){

  },
  // OK.
  success: function (){

  }
});

About

This is the new mantained version of the library.

(Used by https://github.com/geco/utorrent-console)

License

MIT © 2016 contributors