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

heinzelmann

v0.0.7

Published

A loose collection of useful and useless Utilities

Readme

node-heinzelmann

The Node-Heinzelmann is a loose collection of useful and useless Utilities written in JavaScript for node.js.

For Installation type npm install heinzelmann

README Contents

Utilities to write a response to the client. You get it with:

require('heinzelmann').util('http-response', args);

Send a File to the client.

Without options:

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  var resUtil = heinzelmann.util('http-response', res);
  resUtil.download('/tmp/98we72w9a34.zip');
});

server.listen(3000);

With options:

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  var resUtil = heinzelmann.util('http-response', res);
  var options = {
    'clientname': 'your-download.zip' // file presented to client as "your-download.zip"
  }; 
  resUtil.download('/tmp/98we72w9a34.zip', options);
});

server.listen(3000);

Answer request with json.

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  var resUtil = heinzelmann.util('http-response', res);
  var thing = {
    'foo': 'bar'
  };
  resUtil.json(thing);
});

server.listen(3000);

Answer request with an old lady (without any validation).

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  var resUtil = heinzelmann.util('http-response', res);
  var thing = '<foo></foo>';
  resUtil.xml(thing);
});

server.listen(3000);

Grep interesting information out of user's request.

return the ip address of the client. try to get the address even in case of proxies.

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  console.log(heinzelmann.util('http-request', request).ip());
});

server.listen(3000);

return a summary of the request with ip address, cookies, user-agent and the date now. this is useful if you are not interested in the entire request paramesters.

var http = require('http');
var heinzelmann = require('heinzelmann');

var server = http.createServer(function(req, res) {
  console.log(heinzelmann.util('http-request', request).summary());
});

server.listen(3000);

produce mongo purposes

return a mongoclient setting default values. this is useful if you are tired to type "127.0.0.1" ...

var mongodb = require('mongodb');
var heinzelmann = require('heinzelmann');
var mongoclient = heinzelmann.util('mongo-factory', 'db_name').client();

produce a google sitemap out of a given object. use given default values or system default values (lastmod "now", priority 1.00 and changefreq "monthly").

return a google xml sitemap. example (with own priority and changefreq as default, use system lastmod)

var heinzelmann = require('heinzelmann');
var smf = heinzelmann.util('sitemap-factory', 'http://foo.bar');
var urlset = [ {
  loc : '/'
}, {
  loc : '/loc-1.html',
  lastmod : new Date(2000, 0, 1, 2, 3, 4)
}, {
  loc : 'loc-2.html',
  lastmod : '2011-12-16T10:36:26+00:00',
  priority : 0.4,
  changefreq : 'never'
} ];
var defaults = {
  priority : 0.8,
  changefreq : 'daily'
};

The output (where 2012-07-11T10:13:28+00:00 is the date "now"):

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
  <url>
    <loc>http://foo.bar</loc>
    <lastmod>2012-07-11T10:13:28+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.80</priority>
  </url>
  <url>
    <loc>http://foo.bar/loc-1.html</loc>
    <lastmod>2000-01-01T02:03:04+00:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.80</priority>
  </url>
  <url>
    <loc>http://foo.bar/loc-2.html</loc>
    <lastmod>2011-12-16T10:36:26+00:00</lastmod>
    <changefreq>never</changefreq>
    <priority>0.40</priority>
  </url>
</urlset>

format dates to common used representations.

for other things see:

https://github.com/felixge/node-dateformat

https://github.com/minodisk/dateformat-js

for more options see file doc.

return the date in a row

var heinzelmann = require('heinzelmann');
var date = new Date(2003, 4, 6, 7, 12, 55);
var cdf = heinzelmann.util('common-date-format', date);
console.log(cdf.getRow())

output:

'20030506071255'

return a date in W3C Date and Time format with complete date plus hours, minutes and seconds:

http://www.w3.org/TR/NOTE-datetime

var heinzelmann = require('heinzelmann');
var date = new Date(2003, 4, 6, 7, 12, 55);
var cdf = heinzelmann.util('common-date-format', date);
console.log(cdf.getW3CDateTime())

output:

'2003-05-06T07:12:55+00:00'