tomayac / local-reverse-geocoder

Local reverse geocoder for Node.js based on GeoNames data
Apache License 2.0
190 stars 58 forks source link

CSV Parsing issue #63

Closed jrasm91 closed 1 year ago

jrasm91 commented 1 year ago

Every so often I run into CSV parsing issues. The root cause looks to be an incomplete download resulting in the app failing to read the CSV file.

There is no integrity check and no error handling in the case the file does not download properly. The way the caching works, this leads to a CSV parsing error the next time it runs.

Probably could be fixed by renaming the download to something else initially and then change it to the date string on download success.

tomayac commented 1 year ago

Looking at the dumps, there's no integrity data like hashes, so your suggested approach sounds reasonable. Are you up to add this?

jrasm91 commented 1 year ago

Maybe, but probably not anytime soon. I have a hard time following the giant waterfall/callback style implementation :wink:.

tomayac commented 1 year ago

Haha, yeah. The code shows its age. Maybe ChatGPT can optimize it?

twitsforbrains commented 1 year ago

Hello I've created a PR for this: https://github.com/tomayac/local-reverse-geocoder/pull/64

Please review when you get a chance.

Also note that there are no tests in this package so I just kinda hope it works. Let me know if we want a minor version bump or not