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

nzbget-nodejs

v0.0.2

Published

a simple NZBGet JSON-RPC API wrapper for node.js

Downloads

6

Readme

NZBGet-nodejs

What is nzbget-nodejs?

It's a simple NZBGet JSON-RPC (API)[http://nzbget.net/RPC_API_reference] wrapper for node.js

It currently supports, using JSON-RPC methods with and without parameters:

  • version
  • status
  • history
  • append
  • appendURL (convenience method)

This was tested on NZBGet 14.1. Let us know if you've tested it on other versions with success.

Installation

npm install nzbget-nodejs --save

Usage

Setup

This uses a generic_handling function to handle the response but you'll want to customize that.

var nzbget = require('nzbget-nodejs');
var my_ng = new nzbget({
  host: "my.host.com",
  port: 6789,
  username: 'admin',
  password: 'mypassword',
});

var generic_handling= function(err, res){
    if (err) {
      console.log(err);
    } else {
      console.log(res);
    }
}

These three methods are pretty straightforward, they take no parameters and return a string or an object.


my_ng.version(generic_handling);

my_ng.status(generic_handling);

my_ng.history(generic_handling);

append needs at least a URL. Supposedly you can also put the entire NZB file in the Content but I haven't tested that. These are the parameters:

  • NZBFilename - name of nzb-file. Server uses the name to build destination directory. This name can contain full path or only filename. This works when empty, not sure what it's used for otherwise.
  • Content - content of nzb-file encoded with Base64 or URL to fetch nzb-file from. required
  • Category - category for nzb-file. Can be empty string.
  • Priority - priority for nzb-file. 0 for "normal priority", positive values for high priority and negative values for low priority. Downloads with priorities equal to or greater than 900 are downloaded and post-processed even if the program is in paused state (force mode). Default priorities are: -100 (very low), -50 (low), 0 (normal), 50 (high), 100 (very high), 900 (force). Default is 0.
  • AddToTop - true if the file should be added to the top of the download queue or "False" if to the end. false is default
  • AddPaused - true if the file should be added in paused state. false is default
  • DupeKey - "" by default
  • DupeScore - 0 by default
  • DupeMode -- "Force by default"
var appendOptions =
{
  Content: "https://url.to/file.nzb",
  Category: "Open Source"
};

my_ng.append(appendOptions,generic_handling)

appendURL is provided for convenience, using the defaults above:

my_ng.appendURL("https://url.to/file.nzb","Open Source",generic_handling);

Tests

No tests currently available.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Submit Pull Request to support additional methods. Log issues if you run into trouble.

Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 0.0.1 Initial release

TODO

  • Support additional methods
  • Provide a choice between receiving an Object or String in the handler, instead of a JSON document. This might become the default