npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sparse-geonames-ingest

v1.0.0

Published

scripts to generate sparse p2p archives for geonames data

Downloads

4

Readme

sparse-geonames-ingest

scripts to generate sparse p2p archives for geonames data

to search the data generated by this tool, use sparse-geonames-search

Sorting and loading results are written to disk to save memory.

This tool is capable of building an archive from allCountries.txt, a 1.5GB archive (as of 2022) with all geonames data. On my laptop this took 38 minutes and used several gigabytes of RAM. cities500.txt takes 10 seconds.

usage

usage: sparse-geonames-ingest COMMAND {OPTIONS}

sparse-geonames-ingest ingest {-i INFILE} -o OUTDIR

  Load, sort, and build in one command.

sparse-geonames-ingest load {-i INFILE} -o OUTDIR

  Read geonames newline-delimited text file from INFILE or "-" (stdin),
  writing output to OUTDIR.

sparse-geonames-ingest sort -o OUTDIR

  Sort loaded data from OUTDIR, writing results to OUTDIR.

sparse-geonames-ingest build -o OUTDIR (--size=SIZE)

  Build sorted data from OUTDIR, writing results to OUTDIR.
  Each file in the output is at most SIZE bytes.

api

var sgingest = require('sparse-geonames-ingest')

var ingest = sgingest(opts)

  • opts.outdir - directory to use for output and temporary storage
  • opts.recordsLimit - number of records to buffer before flushing to disk
  • opts.lookupLimit - number of lookups to buffer before flushing to disk
  • opts.limit - number of records and lookups to buffer before flushing to disk

ingest.write(line, cb)

Process one line of input from a geonames text file, calling cb(err) when complete.

ingest.flush(cb)

Flush buffered records in memory to disk, calling cb(err) when complete.

ingest.sort(cb)

Sort

ingest.build(opts={}, cb)

install

npm install sparse-geonames-ingest

license

bsd