Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deluger

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deluger

A wrapper around the deluge API.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
0
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 29 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc