Skip to content

A Node.js library for interacting with MACLookup's API v2

Notifications You must be signed in to change notification settings

logocomune/maclookup-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maclookup-js

Build Status

A Node.js library for interacting with MACLookup's API v2. This library allows you to:

  • Get full info (MAC prefix, company name, address and country) of a MAC address

Installation

 npm install @logocomune/maclookup

##Getting Started

const ApiClient = require('@logocomune/maclookup');

let apiClient = new APIClient()
//Add cache
apiClient.withLRUCache()

apiClient.getMacInfo('00:00:00:01', (r) => {
    let m = r['macInfo']

    console.log("MAC found in database:", m['found'])
    console.log("MAC is private (no company name):", m['isPrivate'])
    console.log("Company name:", m['company'])
    console.log("Api response in: ", r['responseTime'])
    console.log("Rate limits - remaining request for current time window:", r['rateLimit']['remaining'])
    console.log("Rate limits - next reset", r['rateLimit']['reset'])
    console.log("===========");
    console.log(r)
    console.log("===========");

  },
  (e) => {
    console.log("Error",e);
  },
  () => {
    console.log("All end")
  });

API Key

Get an API Key here

   let apiClient = new APIClient("an_api_key")
   apiClient.withCache(new LRUCache())

Use custom timout

    let timeout = 5000; //timeout in ms
    let apiClient = new APIClient("an_api_key",timeout);
    // without apikey:
    // let apiClient = new APIClient('',timeout);
    apiClient.withCache(new LRUCache())

About

A Node.js library for interacting with MACLookup's API v2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published