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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ctrl/nzbget

v1.0.1

Published

TypeScript api wrapper for NZBGet using ofetch

Downloads

25

Readme

NZBGet

TypeScript api wrapper for NZBGet using JSON-RPC

Overview

Includes the normalized usenet API shared with @ctrl/sabnzbd:

Use the normalized methods by default. Drop to the native NZBGet methods only when you need JSON-RPC specific behavior such as raw config access, raw editQueue commands, or direct append usage.

Install

npm install @ctrl/nzbget

Use

import { Nzbget } from '@ctrl/nzbget';

const client = new Nzbget({
  baseUrl: 'http://localhost:6789/',
  username: 'nzbget',
  password: 'tegbzn6789',
});

async function main() {
  const data = await client.getAllData();
  console.log(data.queue);
}

Normalized Example

import { Nzbget, UsenetNotFoundError, UsenetPriority } from '@ctrl/nzbget';

const client = new Nzbget({
  baseUrl: 'http://localhost:6789/',
  username: 'nzbget',
  password: 'tegbzn6789',
});

async function main() {
  const id = await client.addNzbUrl('https://example.test/release.nzb', {
    category: 'movies',
    priority: UsenetPriority.high,
    startPaused: false,
  });

  try {
    const job = await client.getQueueJob(id);
    console.log(job.state, job.progress);
  } catch (error) {
    if (error instanceof UsenetNotFoundError) {
      console.log('job missing', error.id);
    }
  }
}

API

Docs: https://nzbget.ep.workers.dev
NZBGet API Docs: https://nzbget.net/api/

Normalized Methods

getAllData()

Returns queue, history, categories, scripts, and status in normalized form. This is the broadest normalized read and fits best when you want an overview in one call.

getQueue()

Returns normalized active queue items.

getHistory()

Returns normalized history items.

getQueueJob(id)

Returns one normalized active queue item. Missing ids throw UsenetNotFoundError.

getHistoryJob(id)

Returns one normalized history item. Missing ids throw UsenetNotFoundError.

findJob(id)

Searches queue first, then history, and returns { source, job } or null. It is the convenient path when you do not know which side the id should be on.

addNzbFile(...) / addNzbUrl(...)

Add an NZB and return the normalized queue id as a string. These are the lighter add helpers when an id is enough. The normalized add option names are category, priority, postProcess, postProcessScript, name, password, and startPaused.

normalizedAddNzb(...)

Add an NZB from either a URL or file content and return the created normalized queue item. This is the higher-level add helper when you want the normalized job back immediately.

Normalized state labels

stateMessage uses the shared UsenetStateMessage vocabulary: Grabbing, Queued, Downloading, Paused, Post-processing, Completed, Failed, Warning, Deleted, and Unknown.

Native API

NZBGet-specific methods are still available when you need the raw JSON-RPC surface.

Connection and discovery:

Queue and rate control:

State Export

const state = client.exportState();
const restored = Nzbget.createFromState(config, state);

Local Testing

Start a disposable NZBGet container on localhost:6789 with the same credentials used by the client defaults:

docker run -d --name nzbget-local-test \
  -p 6789:6789 \
  -e NZBGET_USER=nzbget \
  -e NZBGET_PASS=tegbzn6789 \
  lscr.io/linuxserver/nzbget:latest

Run the full local test suite against that container:

TEST_NZBGET_URL=http://127.0.0.1:6789 TEST_NZBGET_USERNAME=nzbget TEST_NZBGET_PASSWORD=tegbzn6789 pnpm test

If you only want the container-backed integration spec:

TEST_NZBGET_URL=http://127.0.0.1:6789 TEST_NZBGET_USERNAME=nzbget TEST_NZBGET_PASSWORD=tegbzn6789 pnpm test test/integration.spec.ts

Remove the disposable container when you are done:

docker rm -f nzbget-local-test