node-maxmind | Maxmind GEO Lookup | REST library
kandi X-RAY | node-maxmind Summary
kandi X-RAY | node-maxmind Summary
Maxmind GEO Lookup
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of node-maxmind
node-maxmind Key Features
node-maxmind Examples and Code Snippets
Community Discussions
Trending Discussions on node-maxmind
QUESTION
Previously I was using like this:
Now, updated the modules as per node 10
.
So, need help to integrate it.
ANSWER
Answered 2019-Aug-16 at 12:24You need to wait for execution to complete, for that, you should use Promise.
Modify your code as below, then it should work:
QUESTION
I have streaming data coming in with IP address. I want to translate the IP to longitude and latitude before putting the data into my database.
This is what I was doing but it is causing some issues. I also tried putting locationObject outside the for loop. That weirdly is using a lot of memory. I know this is blocking code but it should be fast. Though I see memory issue as data object is coming from a stream continuously ans each data object is huge.
...ANSWER
Answered 2017-Oct-06 at 07:35I'm not sure why you think reading the database file for each iteration of the loop would be fast ("blocking code" doesn't equal "fast code"), it's much better to read the database file once and then loop over data
.
maxmind.openSync()
will read the entire database into memory, which is mentioned in the README:
Be careful with sync version! Since mmdb files are quite large (city database is about 100Mb)
fs.readFileSync
blocks whole process while it reads file into buffer.
If you don't have memory to spare, the only other option would be to open the file asynchronously. Again, not inside the loop, but outside of it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-maxmind
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page