<commit_before># geonames-reader

[![NPM version](https://badge.fury.io/js/geonames-reader.png)](http://badge.fury.io/js/geonames-reader)
[![Build Status](https://travis-ci.org/naturalatlas/geonames-reader.png?branch=master)](https://travis-ci.org/naturalatlas/geonames-reader)
[![Coverage Status](https://coveralls.io/repos/naturalatlas/geonames-reader/badge.png)](https://coveralls.io/r/naturalatlas/geonames-reader)

An async-friendly streaming parser for [geonames data](http://download.geonames.org/export/dump/). It supports the following types of files: "geonames" (features/cities), "adminCodes", "alternateNames", "hierarchy", "countryInfo", and "timeZones". The parser spits out objects with appropriate field names, as defined [here](lib/formatters.js).

```sh
$ npm install geonames-reader --save
```

### Usage

```js
var geonames = require('geonames-reader');

geonames.read('US.txt', function(feature, callback) {
    console.log(feature.name);
    console.log(feature.latitude);
    console.log(feature.longitude);
    callback();
}, function(err) {
    console.log('All done!');
});<commit_msg>Updated badges.<commit_after># geonames-reader
[![NPM version](http://img.shields.io/npm/v/geonames-reader.svg?style=flat)](https://www.npmjs.org/package/geonames-reader)
[![Build Status](http://img.shields.io/travis/naturalatlas/geonames-reader/master.svg?style=flat)](https://travis-ci.org/naturalatlas/geonames-reader)
[![Coverage Status](http://img.shields.io/coveralls/naturalatlas/geonames-reader/master.svg?style=flat)](https://coveralls.io/r/naturalatlas/geonames-reader)

An async-friendly streaming parser for [geonames data](http://download.geonames.org/export/dump/). It supports the following types of files: "geonames" (features/cities), "adminCodes", "alternateNames", "hierarchy", "countryInfo", and "timeZones". The parser spits out objects with appropriate field names, as defined [here](lib/formatters.js).

```sh
$ npm install geonames-reader --save
```

### Usage

```js
var geonames = require('geonames-reader');

geonames.read('US.txt', function(feature, callback) {
    console.log(feature.name);
    console.log(feature.latitude);
    console.log(feature.longitude);
    callback();
}, function(err) {
    console.log('All done!');
});
{'fraction_non_alphanumeric': 0.17657419638925584, 'fraction_numerical': 0.0, 'mean_word_length': 5.604651162790698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6129470', 'n_tokens_mistral': 757, 'n_tokens_neox': 737, 'n_words': 125}