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

transmission-native

v0.4.6

Published

transmission-native

Downloads

24

Readme

transmission-native

Native bindings for libtransmission.

JavaScript Style Guide

Installation

The npm package offers prebuilt binaries only for Linux x64 for now. Please refer to development for other systems.

Usage

const Transmission = require('transmission-native')

// Create a transmission instance with config folder and app name
const tr = new Transmission('./transmission', 'transmission')

const response = await tr.request({ method: 'session-get' })


// Add a new torrent
const message = {
    method: 'torrent-add',
    arguments: {
        filename: 'https://webtorrent.io/torrents/tears-of-steel.torrent'
    }
}

const reponse = await tr.request(message)
console.log(response)

// Save settings
tr.saveSettings()

// Later, when the process should be stopped, close the instance before
tr.close()

Please refer to transmission's rpc-spec.md to find what methods and arguments are expected.

API

tr = new Transmission(configDir, appName)

Create a transmission instance with a specific configuration folder and application name.
configDir is the path where settings and state of the transmission process will be loaded and stored.

tr.request(message)

Make a request to the transmission instance. message is an object expected by transmissions's rpc-spec.md.

const message = { method: 'session-get' }

const reponse = await tr.request(message)
console.log(response)

// or as a callback
tr.request(message, (err, response) => {
  if (err) throw err
  console.log(response)
})

tr.saveSettings()

Save transmission settings.

tr.close()

Save settings and close the session.

Development

You'll need to install required build tools and libraries for your platform in order to compile libtransmission:

Fedora / RHEL

sudo dnf install cmake gcc-c++ libcurl-devel openssl-devel

Windows

vcpkg install curl --triplet=x64-windows-static
vcpkg install openssl --triplet=x64-windows
npm run fetch-deps
# For Windows you need to set VCPKG_INSTALLATION_ROOT env variable
# $Env:VCPKG_INSTALLATION_ROOT="PATH_TO_VCPKG"
npm run build-transmission
npm install
npm test # optional

License

GPL-3.0