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

@tombcato/china-zipcode-data

v1.0.2

Published

本项目包含中国省市区县的 Adcode 和 Zipcode 对应数据。 数据来源于网络整理。

Readme

China Zipcode Adcode Data

本项目包含中国省市区县的 Adcode 和 Zipcode 对应数据。 数据来源于网络整理。

如何使用 (jsDelivr CDN)

你可以直接通过 CDN 引用本数据,无需自行部署服务器。

获取最新版本

// 建议使用具体版本号,例如 @1.0.0,避免缓存问题
const url = "https://cdn.jsdelivr.net/gh/tombcato/china-zipcode-data@main/china_zipcode_adcode.json";

fetch(url)
  .then(response => response.json())
  .then(data => {
    console.log(data);
    // 在此处处理数据
  });

模糊查询示例

async function search(keyword) {
    const response = await fetch("https://cdn.jsdelivr.net/gh/tombcato/china-zipcode-data@main/china_zipcode_adcode.json");
    const data = await response.json();
    return data.filter(item => 
        item.name.includes(keyword) || 
        item.province.includes(keyword) ||
        item.city.includes(keyword)
    );
}

数据字段说明

JavaScript SDK 使用指南

本项目提供了一个同构的 JavaScript SDK,支持 Node.js 和浏览器环境。

安装

npm install china-zipcode-adcode

使用 (Node.js / Webpack / ESM)

import { get, search } from 'china-zipcode-adcode';

// 1. 精确查找
const region = await get('110101');
console.log(region);

// 2. 搜索 (支持组合条件)
// 搜索 "朝阳"
const res1 = await search('朝阳'); 

// 搜索 "朝阳" 且城市包含 "北京"
const res2 = await search('朝阳', '北京');

// 搜索 "朝阳" 且省份包含 "吉林"
const res3 = await search('朝阳', null, '吉林');

使用 (浏览器 CDN 推荐)

无需安装,直接引用即可。数据会自动从 jsDelivr CDN 加载。

提示: @latest 会指向最新版本,但可能有缓存延迟。生产环境建议锁定版本号 (如 @1.0.2)。

<script type="module">
  // 引用最新版 (使用 +esm 自动处理模块加载)
  import { search } from 'https://cdn.jsdelivr.net/npm/@tombcato/china-zipcode-data@latest/+esm';
  
  search('朝阳').then(results => {
    console.log(results);
  });
</script>

字段说明

  • name: 名称
  • province: 省份
  • city: 城市
  • zipCode: 邮政编码
  • pinyin: 拼音

多语言使用示例 (Multi-language Examples)

本数据为标准 JSON 格式,任何语言都可以轻松解析。

Python

import requests
import json

# 方式 1: 在线加载
url = "https://cdn.jsdelivr.net/gh/@tombcato/china-zipcode-data@main/china_zipcode_adcode.json"
data = requests.get(url).json()

# 方式 2: 本地加载
with open('china_zipcode_adcode.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

# 查找示例
def find_by_code(code):
    return next((item for item in data if item['code'] == code), None)

print(find_by_code('110101'))