Coder Social home page Coder Social logo

Comments (9)

bluesmoon avatar bluesmoon commented on July 19, 2024

wanna submit a patch? ;)

from node-geoip.

defunctzombie avatar defunctzombie commented on July 19, 2024

would it be a problem if I just removed the warning altogether? Another alternative is to use a method in place of a direct require:

var geoip = require('geoip-lite').db( ... options ... );

This has the added benefit of letting users specify locations for db files. If the user specifies a city file then they would get that. Obviously there would be defaults for options to load the currently available files.

Thoughts? If this seems like something you would merge in I will gladly write the patch for it.

from node-geoip.

bluesmoon avatar bluesmoon commented on July 19, 2024

yep, this would be a good way forward.

from node-geoip.

bluesmoon avatar bluesmoon commented on July 19, 2024

Might be better to use an init() method on the geoip object which takes a config object as a parameter.

The init method loads up the database based on its config options:

db: city -> loads default city database
db: country -> loads default country database
db: path/to/file -> loads specified file

For every specified db, it should try to load both the ipv4 and ipv6 versions.

A second parameter can specify whether to turn on warnings or not. This will throw a warning if the specified db was not available/readable and we had to fall back.

from node-geoip.

defunctzombie avatar defunctzombie commented on July 19, 2024

I think the warnings would be implied if you specified a file but it was not found. node.js file readers will fail and we could probly let them do that and just send the error to the user.

from node-geoip.

reneretz avatar reneretz commented on July 19, 2024

Have you implemented it?

from node-geoip.

bluesmoon avatar bluesmoon commented on July 19, 2024

I don't believe this has been implemented yet.

from node-geoip.

jordanj77 avatar jordanj77 commented on July 19, 2024

+1

from node-geoip.

bluesmoon avatar bluesmoon commented on July 19, 2024

Ok, I've decided to just drop the warning altogether.

from node-geoip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.