easy-ja-postal-code-generate-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

easy-ja-postal-code-generate-json npm version

Features

  • 郵便局のサイトから最新の郵便番号データをダウンロード&json に変換
  • ファイルが 10MB 以上と重い為、郵便番号の上3桁ごとに json ファイルを分割しています。
  • 外部データではなく、自サーバーで住所データが管理できます。

Recommendation

easy-ja-postal-code-search-address
こちらのパッケージと合わせて使う事をオススメします
https://www.npmjs.com/package/easy-ja-postal-code-search-address

Data

日本郵便の全国一括版住所の csv データを使用して加工します。
https://www.post.japanpost.jp/zipcode/dl/oogaki-zip.html

Requirement

  • Node.js: v18.13.0

Usage

npx ejpc-generate-json -d "assets/json/zip" -t

このように index ファイルと頭3桁の数字のファイルが生成されます。

├── 001.json
├── 002.json
├── 003.json
〜
〜
├── 998.json
├── 999.json
├── _time.json
└── index.json
# index.json
# 頭3桁の配列

[
  "001",
  "002",
  "003",
  〜
]
# 001.json

[
  {
    "zip": "0010000",
    "prefectures": "北海道",
    "city": "札幌市北区",
    "other": ""
  },
  {
    "zip": "0010045",
    "prefectures": "北海道",
    "city": "札幌市北区",
    "other": "麻生町"
  },
  {
    "zip": "0010010",
    "prefectures": "北海道",
    "city": "札幌市北区",
    "other": "北十条西(1~4丁目)"
  },
  〜
  〜
]

option

パラメータ 説明 default
-u csv のダウンロード元の URL(基本変更の必要無し) (日本郵便の公式サイトの全国版の zip ファイル URL)
-d 生成した json の出力先ディレクトリ json/zip
-t 生成したタイムスタンプを入力した json も出力 false

Author

License

"easy-ja-postal-code-generate-json" is under MIT license.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    0
    • latest

Version History

Package Sidebar

Install

npm i easy-ja-postal-code-generate-json

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

7.93 kB

Total Files

6

Last publish

Collaborators

  • underground0930