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

postalcode-geocode

v1.1.0

Published

Resolve global postal/ZIP codes to lat/lon/timezone using GeoNames (download-once local cache)

Readme

postalcode-geocode

Resolve global postal / ZIP codes to latitude, longitude, and IANA timezone using GeoNames data.

The npm package is small. On first use (or postalcode-geocode setup) it downloads the GeoNames postal dump (~19 MB), builds a local SQLite cache, then works offline.

Install

npm install postalcode-geocode

Requires Node.js ≥ 18 (uses better-sqlite3 for the local postal cache).

Setup

npx postalcode-geocode setup

Or the first lookupPostalCode() call will download automatically.

Data directory:

  • Windows: %LOCALAPPDATA%\postalcode-geocode\
  • macOS/Linux: ~/.cache/postalcode-geocode/
  • Override: POSTALCODE_GEOCODE_DATA_DIR

Usage

import { lookupPostalCode, toHebcalLocation } from 'postalcode-geocode';

const place = await lookupPostalCode('10952');
// {
//   postalCode: '10952',
//   countryCode: 'US',
//   placeName: 'Monsey',
//   admin1: 'New York',
//   latitude: 41.11…,
//   longitude: -74.08…,
//   tzid: 'America/New_York',
//   accuracy: …
// }

// Optional: convert for @hebcal/core zmanim
import '@hebcal/core'; // peer dependency
const location = await toHebcalLocation(place);

API

| Function | Description | |----------|-------------| | lookupPostalCode(code, countryCode?) | Look up a postal/ZIP. US 5-digit codes work without country. | | ensureData({ force? }) | Download + build cache | | getDataPath() / dataReady() | Cache location / readiness | | toHebcalLocation(result) | Build @hebcal/core Location (optional peer) |

CLI

postalcode-geocode setup
postalcode-geocode lookup 10952
postalcode-geocode lookup SW1A GB
postalcode-geocode path

Attribution

Postal code data © GeoNames under CC BY 4.0. Please credit GeoNames if you use this package.

Timezone resolution via geo-tz.

Notes

  • UK / Canada / Netherlands entries in allCountries.zip may be outward codes only (not full unit-level postcodes). See the GeoNames postal readme.
  • Coordinates are estimates from GeoNames (accuracy field 1–6).