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

nitpin

v0.2.0

Published

NNTP Client Library

Downloads

4

Readme

Nitpin

Nitpin is an NNTP (Usenet/Newsgroups) client library written in JavaScript for node.js/io.js.

Install

$ npm install nitpin

Features

  • Handles multiple connections
  • Reaps idle connections after 30 seconds of inactivity
  • Download NZBs & yEnc decoding
  • PAR repairs (requires par2 installed on your system)

Todo

  • Add support for more commands
  • Multi-server support
  • ...

Available command methods

  • getHead (HEAD)
  • getBody (BODY)
  • getArticle (ARTICLE)
  • stat (STAT)
  • over (XZVER/XOVER/OVER)
  • group (GROUP)
  • capabilities (CAPABILITIES)
  • list (LIST ACTIVE [wildmat])

Examples

Create a Nitpin instance

var Nitpin = require('nitpin'),
    server = new Nitpin({
        host: 'news.php.net', // Example uses the open PHP newsgroups server
        user: null,           // Example doesn't need username
        pass: null,           // Nor password
        port: 119,
        secure: false,
        connections: 1        // 1 is the default amount of connections
    });

Get an overview of messages for the given group

// Automatically tries XZVER, falls back to XOVER when not available
server.over('php.doc.nl', 2, 5, function gotMessages(err, messages) {

    console.log(messages[0]);
    // { id: '2',
    // subject: 'test',
    // from: '[email protected] (Derick Rethans)',
    // date: 'Mon, 24 Jun 2002 14:54:22 +0200 (CEST)',
    // 'message-id': '<[email protected]>',
    // references: '',
    // bytes: '',
    // lines: '9',
    // xref: 'php.doc.nl:2' }
});

Get an article

// Get a specific article from a group
server.getArticle('php.doc.nl', '[email protected]', function gotArticle(err, headers, body) {

    console.log(headers);
    // { path: 'news.php.net',
    //  xref: 'news.php.net php.doc.nl',
    //  'return-path': '<[email protected]>',
    //  'mailing-list': 'contact [email protected]; run by ezmlm',
    //  'delivered-to': 'mailing list [email protected]',
    //  received: 'from jdi.jdimedia.nl (jdi.jdimedia.nl [212.204.192.51])\n\tby jdi.jdimedia.nl (8.12.4/8.12.4) with ESMTP id g5OCsM6M021379\r',
    //  'by pb1.pair.com with smtp; 24 jun 2002 12': '53',
    //  'for <[email protected]>; mon, 24 jun 2002 14': '54',
    //  date: 'Mon, 24 Jun 2002 14',
    //  'x-x-sender': '[email protected]',
    //  to: '[email protected]',
    //  'message-id': '<[email protected]>',
    //  'mime-version': '1.0',
    //  'content-type': 'TEXT/PLAIN; charset=US-ASCII',
    //  subject: 'test',
    //  from: '[email protected] (Derick Rethans)' }
});

Get an NZB and stream the contents

This is still in development and needs a lot more refining.

// Parse an NZB: supply a path on this computer or a URL to download from
server.parseNZB('/path/to/file.nzb', function parsed(err, nzb) {

    // PAR files and RAR files are currently triaged into their own properties
    // A stream can be created like this
    nzb.rars.main.stream();

    // The contents of the rar file can be streamed using `arcstream`
    // (Which is not yet a dependency)
    var ArcStream = require('arcstream');
    var archive = new ArcStream();

    archive.addFile(nzb.rars.main.stream(), 'rar');

    for (var i = 0; i < nzb.rars.others.length; i++) {
        archive.addFile(nzb.rars.others[i].stream(), 'rar');
    }

    archive.on('file', function(filename, stream, arcfile) {
        console.log('FOUND FILE:', filename);

        stream.on('end', function() {
            console.log(filename, 'has finished streaming');
        });
    });
});

License

MIT