sg-zipcode-to-address-ts

1.0.0 • Public • Published

Zip Code and Address Converter

This command-line tool allows you to convert zip codes to addresses and vice versa using the OneMap API.

Prerequisites

Installation

  1. Clone this repository or download the code.
  2. Navigate to the project directory in your terminal.
  3. Install the required dependencies:
npm install axios dotenv commander fs

4.Install TypeScript and ts-node globally:

npm install -g typescript ts-node

5.Create a .env file in the project directory and add your OneMap API key:

ONEMAP_API_KEY=your_api_key_here

Usage

To convert a zip code to an address, run the following command:

ts-node index.ts --zipcode <zipcode>

To convert an address to a zip code, run the following command:

ts-node index.ts --address "<address>"

To save the addresses for a zip code to a file, add the --file flag:

ts-node index.ts --zipcode <zipcode> --file

Example

ts-node index.ts --zipcode 123456
ts-node index.ts --address "10 Downing St, Westminster, London"

Package Sidebar

Install

npm i sg-zipcode-to-address-ts

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

8.48 kB

Total Files

10

Last publish

Collaborators

  • minmyatoo