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

pincodes-finder

v1.2.0

Published

Lookup city, district, state and country by pincode for India, US, UK, Canada, Australia, Germany and France — with per-country imports to load only the data you need

Readme

pincodes-finder

Lookup city, district, state and country by postal code (PIN/ZIP/postcode) for 🇮🇳 India, 🇺🇸 US, 🇬🇧 UK, 🇨🇦 Canada, 🇦🇺 Australia, 🇩🇪 Germany and 🇫🇷 France — offline, zero dependencies.

Data is bundled at build time from GeoNames, so lookups are fully local (no network calls).

Install

npm install pincodes-finder

Requires Node.js 16+. This is an ES Module package (import, not require).

Usage

import { lookup, lookupByCountry } from "pincodes-finder";

// Auto-detect the country
lookup("110001");
// → {
//     pincode: "110001",
//     city: "Patiala House",
//     district: "Central Delhi",
//     state: "Delhi",
//     country: "India"
//   }

// Target a specific country (faster — skips the other datasets)
lookupByCountry("90210", "us");
// → { pincode: "90210", city: "Beverly Hills", district: "Los Angeles",
//     state: "California", country: "United States" }

// Unknown code → null
lookup("00000"); // → null

Notes

  • Input is normalized (trimmed, upper-cased, spaces stripped), so "sw1a 1aa", "SW1A1AA" and "SW1A 1AA" are treated the same.
  • UK data uses GeoNames outward codes only (e.g. "BN91", "M9"), not full postcodes like "SW1A 1AA".

API

lookup(pincode)

Searches all countries (India → US → UK → Canada → Australia → Germany → France) and returns the first match, or null if none. Because some numeric codes are valid in more than one country (e.g. 75001 is both a US ZIP and a Paris postcode), auto-detect returns the first match in that order — use lookupByCountry when you know the country.

  • pincodestring (required). Throws if empty or not a string.
  • Returns { pincode, city, district, state, country } | null.

lookupByCountry(pincode, country)

Searches a single country's dataset. Faster when you already know the country.

  • pincodestring (required).
  • country — one of "india", "us", "uk", "canada", "australia", "germany", "france" (case-insensitive). Throws on an unknown or missing country.
  • Returns { pincode, city, district, state, country } | null.

Rebuilding the data (maintainers)

The datasets in src/data/ are generated from GeoNames zips in scripts/:

npm run build:data

This extracts each *.zip and regenerates src/data/<country>.js. To refresh the data, download the latest country zips from https://download.geonames.org/export/zip/ into scripts/ first.

License

MIT