Import Postal Codes from into a database


Using Node.js to import Postal Codes from into a database. See for a complete list of available postal codes.

Currently, only mysql is supported. Please adapt functions dbConnect(), dbCreateTable(), dbDeleteTable() and dbInsert() in index.js to support other databases.

Unlike other tools, this tool only requires Node.js and no other libraries.

npm install geonames-postal-codes-import-nodejs
cd node_modules/geonames-postal-codes-import-nodejs
node index.js [options]
    -h, --help                 output usage information
    -V, --version              output the version number
    -h, --host [host]          DB Host
    -u, --user [user]          DB User
    -p, --password [password]  DB Password
    -d, --database [database]  DB Database
    -t, --table [table]        DB table
    -c, --countries <keys>     comma separated list of country codes
  Country Codes: <keys>
    index.js -h localhost -u root -p root123 -d geodb -t postal_codes -c DE,CH,ES
    index.js -h localhost -u root -p root123 -d geodb -t postal_codes -c allCountries