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

demosteinkjer-api

v0.2.0

Published

Node.js client for the Demo Steinkjer API.

Readme

demosteinkjer-api

See https://api.demosteinkjer.no/ for documentation. The API requires a key and a secret to be used.

var api = require('demosteinkjer-api')('key', 'secret');

To get time series data for a given meter, a download url must first be obtained.

api.requestDownloadURL(meterID, options, function(downloadURL) {
  console.log(downloadURL);
});

Although you receive a link, it will not be immediately available to use. This can be solved in multiple ways. If one tries to send a GET request to a resource that is not yet available. A response code of 202 will be returned. Thus you can keep on sending requests until it becomes available (check for status code) or you can download the url ahead of time to be somewhat certain it will be available when you need it.

var intervalId = setInterval(function() {
  api.readDownloadURL(downloadURL, function(err, readings) {
    if (err) return;
    console.log(readings);
    clearInterval(intervalId);
  });
}, 1000);

Get the latest reading for a meter

To get the latest reading for a meter, a url must not be obtained first:

api.getLatestMeterReading(meterID, function(err, res) {
  console.log(res);
});

Minute Readers

Some of the meters have minute precision. Their IDs are available in the object api.minuteReaders.

Caching

It is wise to cache results from the API, both meter readings and download urls. Redis is a wise choice for such a task. One way to do it is to create a key hash made of the meter id and the options for that reading

function hash() {
  return [].slice.apply(arguments).reduce(function(h, e) {
    return h + JSON.stringify(e);
  }, '');
}

var key hash(meterID, options)

and store it in redis

var client = require('redis').createClient();
client.set(key, data)

where key is a hash made using any method you'd prefer and data is the data for that request.

License

MIT