geonames-parser
v0.0.2
Published
geonames-parser
Downloads
5
Readme
geonames-parser
$ npm i geonames-parser
Example
var fs = require('fs');
fs.createReadStream('./alternateNames.txt')
.pipe(parser.alternateNames())
.pipe(parser.filter(function (record) {
return record.isolanguage === 'zh';
}))
.pipe(parser.head(100))
.on('data', function (record) {
console.log(record);
});
API
options
Passed to Transform
constructor.
- fields: define fields in the table. example
parser(options)
var fs = require('fs');
fs.createReadStream('./cities1000.txt')
.pipe(parser());
.geoname(options)
Parse geoname
table
var fs = require('fs');
fs.createReadStream('./cities1000.txt')
.pipe(parser.geoname());
.alternateNames(options)
Parse alternate names
table
var fs = require('fs');
fs.createReadStream('./cities1000.txt')
.pipe(parser.alternateNames());
.filter(fn, options)
var fs = require('fs');
fs.createReadStream('./cities1000.txt')
.pipe(parser.alternateNames())
.pipe(parser.filter(function (record) {
return record.isolanguage === 'zh';
}));
.count(options)
var fs = require('fs');
fs.createReadStream('./cities1000.txt')
.pipe(parser.count())
.once('data', function (count) {
console.log(count);
});
.slice(start, end, options)
.head(len, options)
License
(The MIT License)
Copyright (c) 2014 Po-Ying Chen <[email protected]>.