@@ -59,16 +59,16 @@ <h1 class="page-title">Source: index.js</h1>
5959
6060var debug = require('debug')('local-reverse-geocoder');
6161var fs = require('fs');
62- var path = require('path');
6362var parser = require('csv-parse');
6463var parse = parser.parse;
6564var kdTree = require('kdt');
66- var fetch = (...args) =>
67- import('node-fetch').then(({ default: fetch }) => fetch(...args));
6865var unzip = require('unzip-stream');
6966var async = require('async');
7067var readline = require('readline');
7168const { basename } = require('path');
69+ // mod.cjs
70+ const fetch = (...args) =>
71+ import('node-fetch').then(({ default: fetch }) => fetch(...args));
7272
7373// All data from http://download.geonames.org/export/dump/
7474var GEONAMES_URL = 'https://download.geonames.org/export/dump/';
@@ -169,7 +169,7 @@ <h1 class="page-title">Source: index.js</h1>
169169 downloadMethodBoundToThis,
170170 callback
171171 ) {
172- const now = new Date().toISOString().substr (0, 10);
172+ const now = new Date().toISOString().substring (0, 10);
173173
174174 // Use timestamped file OR bare file
175175 const timestampedBasename = `${baseName}_${now}.txt`;
@@ -222,7 +222,7 @@ <h1 class="page-title">Source: index.js</h1>
222222 .then((response) => {
223223 if (!response.ok) {
224224 throw new Error(
225- `Error downloading GeoNames ${dataName} data (response ${response.status} for url ${geonamesUrl})`
225+ `Error downloading GeoNames ${dataName} data (response ${response.status} for URL ${geonamesUrl})`
226226 );
227227 }
228228
@@ -270,7 +270,7 @@ <h1 class="page-title">Source: index.js</h1>
270270 .then((response) => {
271271 if (!response.ok) {
272272 throw new Error(
273- `Error downloading GeoNames ${dataName} data (response ${response.status} for url ${geonamesUrl})`
273+ `Error downloading GeoNames ${dataName} data (response ${response.status} for URL ${geonamesUrl})`
274274 );
275275 }
276276
@@ -285,7 +285,7 @@ <h1 class="page-title">Source: index.js</h1>
285285 .on('entry', (entry) => {
286286 var entryPath = entry.path;
287287 var entryType = entry.type; // 'Directory' or 'File'
288- var entrySize = entry.size; // might be undefined in some archives
288+ var entrySize = entry.size; // Might be undefined in some archives
289289 if (entryType === 'File' && entryPath === fileNameInsideZip) {
290290 debug(
291291 `Unzipping GeoNames ${dataName} data - found ${entryType} ${entryPath}` +
@@ -311,13 +311,12 @@ <h1 class="page-title">Source: index.js</h1>
311311 }
312312 })
313313 .on('finish', () => {
314- // beware - this event is a finish of unzip, finish event of writeStream may and will happen later ...
314+ // Beware - this event is a finish of unzip, finish event of writeStream may and will happen later...
315315 if (foundFiles === 1) {
316- // ... so if we found one file, we call callback in it's finish event above
316+ // ...so if we found one file, we call callback in it's finish event above
317317 debug(`Unzipped GeoNames ${dataName} data.`);
318- // return callback(null, outputFilePath);
319318 } else {
320- // .. while if there is something unexpected, we fire callback here
319+ // ... while if there is something unexpected, we fire callback here
321320 debug(
322321 `Error unzipping ${geonamesZipFilename}: Was expecting ${outputFileName}, found ${foundFiles} file(s).`
323322 );
@@ -989,7 +988,7 @@ <h2><a href="index.html">Home</a></h2><h3><a href="global.html">Global</a></h3>
989988< br class ="clear ">
990989
991990< footer >
992- Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 4.0.2 </ a > on Sun Jun 11 2023 00:39:00 GMT+0700 (Western Indonesia Time)
991+ Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 4.0.0 </ a > on Mon Jun 12 2023 11:07:01 GMT+0200 (Central European Summer Time)
993992</ footer >
994993
995994< script > prettyPrint ( ) ; </ script >
0 commit comments