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

pincode-info

v1.0.2

Published

A simple NPM package to get city and post office details by pincode or branch name in India

Downloads

57

Readme

pincode-info

npm version
License

A simple NPM package to get city and post office details by pincode or branch name in India using the India Post API.


Documentation / References

Installation

npm install pincode-info

Usage

Get City by Pincode

const { getCityByPincode, getPostOfficeDetails } = require("pincode-info");

// Get city details by pincode
getCityByPincode("110001")
  .then((city) => console.log("City by Pincode:", city))
  .catch((err) => console.error(err));

Get Post Office Details by Branch Name

const { getCityByPincode, getPostOfficeDetails } = require("pincode-info");

// Get post office details by branch name
getPostOfficeDetails("Connaught Place")
  .then((postOffice) => console.log("Post Office Details:", postOffice))
  .catch((err) => console.error(err));

API Reference

getCityByPincode(pincode)

Get post office details by 6-digit Indian postal code.

Parameters:

  • pincode (string) – the 6-digit Indian postal code

Returns:

  • Promise that resolves to an array of post offices with the following details:
    • name – Post Office name
    • district – District name
    • state – State name
    • country – Country

Example:

const { getCityByPincode } = require("pincode-info");

getCityByPincode("110001")
  .then((postOffices) => console.log("Post Offices:", postOffices))
  .catch((err) => console.error(err));

getPostOfficeDetails(branchName)

Get post office details by branch name.

Parameters:

  • branchName (string) – name of the Post Office branch

Returns:

  • Promise that resolves to an array of post offices with the following details:
    • name – Post Office name
    • district – District name
    • state – State name
    • pincode – Pincode
    • country – Country
    • branchType – Type of Post Office

Example:

const { getPostOfficeDetails } = require("pincode-info");

getPostOfficeDetails("Connaught Place")
  .then((postOffice) => console.log("Post Office Details:", postOffice))
  .catch((err) => console.error(err));

Complete Usage Example

const { getCityByPincode, getPostOfficeDetails } = require("pincode-info");

// Get all post offices in a pincode area
getCityByPincode("110001")
  .then((postOffices) => {
    console.log("Post offices in 110001:");
    postOffices.forEach((office) => {
      console.log(`- ${office.name}, ${office.district}, ${office.state}`);
    });
  })
  .catch(console.error);

// Get specific post office details
getPostOfficeDetails("Connaught Place")
  .then((offices) => {
    if (offices.length > 0) {
      const office = offices[0];
      console.log(`Pincode: ${office.pincode}`);
      console.log(`Branch Type: ${office.branchType}`);
      console.log(`Location: ${office.district}, ${office.state}`);
    }
  })
  .catch(console.error);

Example Output:

{
"Name": "Aliganj",
"Description": null,
"BranchType": "Sub Post Office",
"DeliveryStatus": "Non-Delivery",
"Circle": "Bihar",
"District": "Bhagalpur",
"Division": "Bhagalpur",
"Region": "Patna HQ",
"Block": "Jagdishpur",
"State": "Bihar",
"Country": "India",
"Pincode": "812005"
},