How to use the @maxmind/geoip2-node.Reader function in @maxmind/geoip2-node

To help you get started, we’ve selected a few @maxmind/geoip2-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxmind / GeoIP2-node / e2e / js / index.spec.js View on Github external
const WebServiceClient = require('@maxmind/geoip2-node').WebServiceClient;
const Reader = require('@maxmind/geoip2-node').Reader;

describe('WebServiceClient', () => {
  it('exists', () => {
    const client = () => new WebServiceClient('1234', 'foo');

    expect(client).not.toThrowError();
  });
});

describe('Reader', () => {
  it('exists', async () => {
    expect.assertions(1);
    const response = await Reader.open('../GeoIP2-City-Test.mmdb');
    expect(response.city('175.16.199.1')).toHaveProperty('city.geonameId');
  });
});

@maxmind/geoip2-node

Node.js API for GeoIP2 webservice client and database reader

Apache-2.0
Latest version published 11 months ago

Package Health Score

77 / 100
Full package analysis