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

deluger

v0.4.0

Published

A wrapper around the deluge API.

Downloads

14

Readme

Deluger

Deluger is a simple Node.js wrapper around the Deluge API, providing a convenient interface to interact with Deluge torrent client (version 2.1 and above).

Compatibility

Important: This package is only compatible with Deluge version 2.1 and above.

Installation

You can install Deluger using npm:

npm install deluger

Usage

Here's a basic example of how to use Deluger:

import Deluge from 'deluger';

const deluge = new Deluge('http://localhost', 'password', 8112);

// Get current status
const status = await deluge.getStatus(['progress']);
console.log(status);

// List torrents
const torrents = await deluge.listTorrents();
console.log(torrents);

API

Constructor

new Deluge(hostname: string, password: string, port: number = 8112)

Creates a new Deluge instance.

Methods

authenticate()

Authenticates with the Deluge server, is also called authomatically when another method is called while not being authenticated.

  • Returns: Promise<boolean>

addTorrent(torrent: Buffer, location?: string)

Adds a torrent to Deluge.

  • Parameters:
    • torrent: Buffer - The torrent file as a buffer
    • location: string (optional) - The download location
  • Returns: Promise<TorrentHash>

getConfig()

Gets the current configuration of the Deluge client.

  • Returns: Promise<ConfigResult>

getStatus(properties?: (keyof Torrent)[])

Gets the current status of the Deluge client.

  • Parameters:
    • properties: (keyof Torrent)[] (optional) - List of properties to retrieve
  • Returns: Promise<StatusResult>

listTorrents(torrentHashes?: TorrentHash[], properties?: (keyof Torrent)[])

Lists torrents in the Deluge client.

  • Parameters:
    • torrentHashes: TorrentHash[] (optional) - List of torrent hashes to filter
    • properties: (keyof Torrent)[] (optional) - List of properties to retrieve
  • Returns: Promise<Torrents | TorrentsWithProps>

removeTorrent(torrentHash: TorrentHash, removeData: boolean = false)

Removes a torrent from the Deluge client.

  • Parameters:
    • torrentHash: TorrentHash - Hash of the torrent to remove
    • removeData: boolean (optional) - Whether to remove the downloaded data as well
  • Returns: Promise<boolean>

Development

To set up the development environment:

  1. Clone the repository
  2. Run npm install
  3. Use the following commands:
    • make dev: Run the development server
    • make test: Run tests
    • make lint: Run linter
    • make build: Build the project

For testing purposes, you can use the official Deluge Docker image. To run a Deluge instance:

docker run -d \
  --name=deluge \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e DELUGE_LOGLEVEL=error `#optional` \
  -p 8112:8112 \
  -p 6881:6881 \
  -p 6881:6881/udp \
  -p 58846:58846 `#optional` \
  -v /path/to/deluge/config:/config \
  -v /path/to/downloads:/downloads \
  --restart unless-stopped \
  lscr.io/linuxserver/deluge:latest

This will start a Deluge instance that the tests can use. Make sure to adjust the paths and port mappings as needed for your environment.

I'm not sure why, but this only starts working after first logging in once in the web ui (localhost:8112, default password 'deluge')

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you find any bugs or have feature requests, please create an issue on the GitHub repository.