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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lpdg-iomanager

v1.0.4

Published

An IOManager that saves the generated result to files, is able to use websockets to stream or let a client poll for data or just returns the value of the lpdgenerator.

Readme

lpdg-iomanager

An IOManager that saves the generated result to files, is able to use websockets to stream or let a client poll for data or just returns the value of the lpdgenerator.

Usage

First install lpdg-iomanager:

npm install lpdg-iomanager -s
const lpdgenerator = require('lpdgenerator');
const lpdgiomanager = require('lpdg-iomanager')

var generator = new lpdgenerator();
var manager = new lpdgiomanager();

manager.run(generator);

And then run the program with an input file as parameter:

node myprog <input-file>

Input

There is an example input file in the root.

Name | Description | Default --- | --- | --- time:interval | The interval at which the parkings get updated and the stream sends updates | 30 file:output | The output directory | "" file:output_meta_data | Bool to see if meta data should be put in the file | false file:extension | Defines the extension of the generated files | "" file:name_format | Defines the format of the output filenames. DEFAULT: city-YYYY-MM-DDThhmmss, UNIX: UNIX timestamp of beginning of interval. | "DEFAULT" file:split | If files of cities should be split, if false will ignore "time:time_per_file" | true io:mode | Mode can be FILE, STREAM, POLL or STRING. If something other then FILE is used, most "file:xxxxx" variables will be ignored | "FILE" io:port | Port at which the websockt is made | 8080

Websockets

When the "io:mode" is STREAM or POLL, the manager will create a websocket to send data over the network.

STREAM

When streaming, the IOManager will send data to subscribed clients every "time:interval" seconds. To subscribe, clients have to send a JSON object with following parameters:

Name | Description --- | --- type | Can have te value INFO (if we just want to get info on the cities and parkings), SUB (if we want to subscribe to a city) or UNSUB (if we want to unsubscribe from a city) city | If the type of the request is SUB or UNSUB this value should be the number of the city we want to (un)subscribe

Sample client

const WebSocket = require('ws');

const ws = new WebSocket('ws://localhost:8080');
 
ws.on('open', function open() {
  ws.send('{"type" : "SUB", "city":0}');
});
 
ws.on('message', function incoming(data) {
  console.log(data.toString());
});

POLL

When the mode is POLL, clients have to requist data every time they want to have an update. CLients should send a JSON object with following parameters:

Name | Description --- | --- type | Can have te value INFO (if we just want to get info on the cities and parkings), GET (if we want to get the parking data) city | If the type of the request is GET this value should be the number of the city we want time | If the type of the request is GET this value should be the begin value of the data

Sample client

const WebSocket = require('ws');

const ws = new WebSocket('ws://localhost:8080');
 
ws.on('open', function open() {
  ws.send('{"type" : "GET", "city":0, "time": "1970-01-01T00:00:00"}');
});
 
ws.on('message', function incoming(data) {
  console.log(data.toString());
});

FILE

File output will just output the result for every city in separate files.