indian_address
It gives list of states, districts on each state and pincode on each district.
Installation
You can install it using npm:
npm install indian_address
Usage
Here's details of how to use indian_address library.
Note: for typescript you can use type as imported like states, districts, pininfo
Getting states list
const {states} = require("indian_address");
console.log(states)
// output: [ "Gujarat","Haryana", "Himachal Pradesh", "Jammu & Kashmir", ... ]
Getting districts list (for example up)
const {districts} = require("indian_address");
console.log(districts["uttar pradesh"])
// output: [ "Meerut", "Bagpat", "Ghaziabad", "Bulandshahr", "Aligarh" ... ]
Getting pincode list (for example up, lucknow)
const {pincodes} = require("indian_address");
// state and district separated by underscore ( _ )
// for example state: uttar pradesh and district: lucknow as written bellow
console.log(pincodes["uttar pradesh_lucknow"])
// output: [ "226002", "226003", "226016", "226018", "226026", ... ]
Getting pincode list (for example up, lucknow)
const {pininfo} = require("indian_address");
console.log(pininfo["110001"])
// output: { "state": "Delhi", "city": "Central Delhi" }
console.log(pininfo["110001"])
// output: { "state": "Delhi", "city": "Central Delhi" }
Acknowledgments
This library uses data from https://data.opendatasoft.com/explore/dataset/geonames-postal-code%40public/?sort=-latitude for pincode information.
Contact
If you have any questions or suggestions, please feel free to contact us.
Siddharth Sharma i@sidsharma.in