https://github.com/holyshared/zip-code-stream
The zip code stream for japanese
https://github.com/holyshared/zip-code-stream
csv jp nodejs stream zip-code
Last synced: 5 months ago
JSON representation
The zip code stream for japanese
- Host: GitHub
- URL: https://github.com/holyshared/zip-code-stream
- Owner: holyshared
- License: mit
- Created: 2016-04-05T00:45:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-24T06:59:08.000Z (over 9 years ago)
- Last Synced: 2025-02-17T13:45:20.095Z (10 months ago)
- Topics: csv, jp, nodejs, stream, zip-code
- Language: JavaScript
- Homepage:
- Size: 1.58 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zip-code-jp-stream
[](https://badge.fury.io/js/zip-code-jp-stream)
[](https://travis-ci.org/holyshared/zip-code-stream)
[](https://david-dm.org/holyshared/zip-code-stream)
It provides a stream for reading the data of the japanese postal code.
## Basic usage
This module supports the stream of CSV / ZIP format.
### Stream of ZIP file
By using the **createFromZipFile**, it can be read the data from the ZIP format of the file.
```js
const stream = require('zip-code-jp-stream');
const reader = stream.createFromZipFile('../ken_all.zip');
reader.on('data', (r) => {
console.log(r); // CSV record object
});
reader.on('end', () => {
console.log('end');
});
```
### Stream of CSV file
You can generate the CSV of the stream.
```js
const stream = require('zip-code-jp-stream');
const reader = stream.createFromCSVFile('../ken_all.csv');
reader.on('data', (r) => {
console.log(r); // CSV record object
});
reader.on('end', () => {
console.log('end');
});
```
## Object format
Format of the object that will be called from the stream is as follows.
For the string, it has been converted from Shift_JIS to UTF8.
|プロパティ|説明|
|:------------|:------------|
|jis_code|全国地方公共団体コード(JIS X0401、X0402)|
|legacy_zip_code|(旧)郵便番号(5桁)|
|zip_code|郵便番号(7桁)|
|prefecture_kana|都道府県名|
|city_kana|市区町村名|
|area_kana|町域名|
|prefecture|都道府県名|
|city|市区町村名|
|area|町域名|
|tow_zip_code_display|一町域が二以上の郵便番号で表される場合の表示|
|number_of_address_display|小字毎に番地が起番されている町域の表示 (注4) (「1」は該当、「0」は該当せず)|
|city_block_display|丁目を有する町域の場合の表示 (「1」は該当、「0」は該当せず)|
|one_zip_code_display|一つの郵便番号で二以上の町域を表す場合の表示 (注5) (「1」は該当、「0」は該当せず)|
|changed_status|更新の表示(注6)(「0」は変更なし、「1」は変更あり、「2」廃止(廃止データのみ使用))|
|changed_reason|変更理由 (「0」は変更なし、「1」市政・区政・町政・分区・政令指定都市施行、「2」住居表示の実施、「3」区画整理、「4」郵便区調整等、「5」訂正、「6」廃止(廃止データのみ使用))|
## Execution of the test
1. install node modules
npm install
2. running the test
npm test