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

torrent-xiv

v0.0.7

Published

High level BitTorrent client

Downloads

5

Readme

torrent-xiv

High level torrent client for node.js

Usage

npm install --save torrent-xiv

var Torrent = require('torrent-xiv');

var torrent = new Torrent('magnet:link-example');
torrent.on('progress', console.log); // prints torrent.status()
torrent.on('complete', console.log); // prints torrent.metadata

API

Constructor

new Torrent(source, opts) : creates torrent and starts it, opts:

{ connections: 100,      // Max number of connections
  uploads: 10,           // Max number of upload slots
  path: os.tmpdir(),     // Directory to save files to
  mkdir: true,           // Make a directory in opts.path? Name will be the info hash
  seed: false,           // NYI - Seed the torrent when done instead of quitting?
  start: true,           // Auto-start the download?
  statFrequency: 2000 }  // How often to broadcast 'stats'

Events

torrent.on('metadata', fn) : obtained torrent info from peers, passes .metadata to fn
torrent.on('progress', fn) : data was downloaded, passes .status() to fn
torrent.on('stats', fn) : emits periodically while active, passes .stats() to fn
torrent.on('complete', fn) : all files have been downloaded, passes .metadata to fn

torrent.on('active', fn) : triggered by .start() once the download begins
torrent.on('inactive', fn) : triggered by .pause() and on complete

Properties & Methods

torrent.metadata : general torrent data, available after metadata event fires

{ name:         (torrent name),
  source:       (magnet link || Buffer, as provided by user),
  infoHash:     (torrent hash),
  directory:    (path to directory with saved files),
  files: 
   [ { name:            (file name),
       bytes:           (number of bytes),
       humanBytes:      (human readable file size, e.g. '2.63 MB'),
       path:            (direct path to this file, may be absolute or relative),
       torrentPath:     (path of file relative to torrent directory) } ]}

torrent.status() : returns whether it's paused or active, and percentage.

{ active:       (boolean),
  percentage:   (number: 23.87),
  infoHash:     (torrent hash) }

torrent.stats() : returns transfer speeds, number of peers, etc.

{ infoHash:      (torrent hash),
  downSpeed:     (number),
  upSpeed:       (number),
  downloaded:    (number),
  uploaded:      (number),
  peersTotal:    (number),
  peersUnchoked: (number) }

torrent.start() : activates the torrent. No need to call this unless you've paused.
torrent.pause() : closes all connections.

© 2015 Andrea Stella, MIT license.