cities-5000-structured
v1.0.1
Published
A low-memory, structured loader for the GeoNames.org cities-5000 dataset.
Downloads
2
Readme
cities-5000-structured
A low-memory, structured loader for the GeoNames.org cities-5000 dataset.
The package provides a generator that outputs each record in the data set, structured & parsed – ints & floats are converted to number
s, 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 cities5000 from 'cities-5000-structured';
for (const record of cities5000()) {
// `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.