cities-500-structured
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

cities-500-structured

View code coverage on codecov

A low-memory, structured loader for the GeoNames.org cities-500 dataset.

The package provides a generator that outputs each record in the data set, structured & parsed – ints & floats are converted to numbers, lists are converted to string[] arrays, and dates are converted to Date objects. See the schema for details.

The data file is bundled with the package so can be used offline, and the package uses no dependencies.

Usage

The default export function provides a generator which can be iterated to access each record without storing the entire dataset in memory:

import cities500 from 'cities-500-structured';

for (const record of cities500()) {
  // `record` is an object containing that record's details
  console.log(`Record #${record.geonameId}: "${record.name}"`, record);
}

Module under MIT License, geo data via GeoNames.org, CC BY 4.0.

/cities-500-structured/

    Package Sidebar

    Install

    npm i cities-500-structured

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    32.5 MB

    Total Files

    18

    Last publish

    Collaborators

    • adamaveray