Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

getyourbit

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getyourbit

Getyourbit.com client

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GetYourBit.com client

This library allows you to make requests easily.

Examples

const GetYourBit = require('getyourbit');
const api = new GetYourBit.Api('https://ip.getyourbit.com');

api.auth('login', 'password').then(() => {
  return api.request('/lookup/8.8.8.8/');
})
.then((body) => {
  return api.request('/me/', {locale: 'en-US'}).then((body) => {
    console.log(body.data);
  });
})
.then((res) => {
  return api.scroll('/find/', {
    size: 500,
    query: {
      country: 'nepal'
    }
  }, (body, chunkData, fullData) => {
    console.log(chunkData.length);
  });
})
.then((fullData) => {
  console.log(fullData.length);
  return api.logout();
})
.catch((err) => {
  console.error(err);
});

Api

.auth(login, password, options={})

Login to the API. You can get login and password on the site after a subscription.
options is request module options.
Free services don't require authorization.

.logout()

Logout from the API. It gives an error without authorization before.

.request(url, data={}, options={})

Request to the API without scrolling to get data.
It returns all response body as object.

.scroll(url, data={}, options={}, callback=null)

.scroll(url, data={}, callback=null)

.scroll(url, callback=null)

Request to the API with scrolling to get data. You can pass callback to control every chunk. You will get three arguments:

  • body - chunk response body
  • chunkData - chunk data
  • fullData - full data by the current chunk

It returns the full data at the end

Keywords

FAQs

Package last updated on 13 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc