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

listhub

v1.0.1

Published

ListHub feed download and managment lib

Readme

node-listhub

A Node.js module to handle ListHub feed downloads

Installation

Via npm:

$ npm install listhub

Changelog

v1.0.1

  • Minor bugfixes

older change log

Quick start

Below is the simple usage of this module. Just require the object, initialise and use it.

var lh = require('listhub')({channelId: 'channelId', username: 'username', password: 'pass'});

Below you can find more detailed usage tips and examples.

Usage

Class reference

Properties

+ gzFeedFile               The path of downloaded `gzip` file 
+ xmlFeedFile              The path of extracted `xml` file
+ channelFilesDir          The directory path where all channel files are kept

Methods

+ constructor(options)
+ checkAndGetNewFile(cb)                                                     You can manually run the feed update script with this function
+ getXml()                                                                   Returns the parsed xml as libxml Document object
+ getXmlString()                                                             Returns the string of parsed xml
+ getSingleListingJson(listingXmlElement, cb)                                Returns json object representing single Listing
+ clearFeedFiles(cb)                                                         Remove all files related to the channel (gzip, xml)
+ addStatusReportForListing(listingKey, status, url, message, timestamp, cb) Add status report for a listing
+ generateReportFile(cb)                                                     Generate final report file for previously added statuses

Creating class object

To get started with ListHub, the class object should be created with initial options. Here is an example:

var listHub = require('listhub')({channelId: 'channelId', username: 'username', password: 'pass'});

The constructor takes 1 argument (options). It is an object with some configuration parameters. The possible contents of the object are:

channelId <string>            Your ListHub channel
username <string>             The username for your ListHub account
password <string>             The password for your ListHub account
filename <string>             An optional filename to apply to saved files. If not provided, the channelId will be used
runAt <string|array>          An array containing cron-formatted strings to use for running cron jobs.
setCron <boolean>             A boolean indicating if the constructor should set up cron jobs to get ListHub files
runCronAtOnce <boolean>       Indicates if the feed should be downloaded also immediately after setup
onCronComplete <function>     Function to run at cron job completion
tmpDirectory <string>         Path to temp directory where feed files will be kept
reportFile <string | boolean> Path to reports file to save for ListHub. If not specified will be equal to '{tmpDirectory}/{channelId}/report.xml'

If no runAt is provided, the module will download and store the feed file every day at 00:00:00. If you want to specify your own schedule you can provide your time in cron format.

Example:

var listHub = require('listhub')({runAt: '00 00 07 * * *', ...});

If you want to run the script lets say several times a day, you provide an array:

var listHub = require('listhub')({runAt: ['00 00 00 * * *', '00 00 06 * * *', '00 00 12 * * *'], ...});

When the listHub is set up, you can call some methods on it like:

var xmlDoc = lh.getXml();
lh.getSingleListingJson(xmlDoc.child(1), function(err, json) {
    //handle error here
    console.log(JSON.stringify(json));
});