New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nip-urls

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nip-urls

Nip URL shortening tool.

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-88.89%
Maintainers
2
Weekly downloads
 
Created
Source

Nip URL Shortening SDK

This is a simple Node.js package to allow easy consumption of the Nip URL shortening service. This library is built with TypeScript.

The service allows you to pass it a url and then receive back a short-url (or longer one) that is fully tracked. These short-urls only work for GET requests.

Installation

npm install nip-urls --save

Usage

To use this library, first import and instantiate the class with your reserved domain name and API key.

const { Nip } = require('nip-urls');

const nip = new Nip('nip.is', 'INSERT_API_KEY_HERE');

Generate tracked short url

const url = await nip.shorten('https://root.co.za/careers');

Generate tracked longer url

const url = await nip.track('https://root.co.za/careers');

Fetch a url

const url = await nip.getUrl('b4949c2b-8a76-44df-8c34-04ccad2f9fb8');

Fetch a url's visits

const visits = await nip.getUrlVisits('b4949c2b-8a76-44df-8c34-04ccad2f9fb8');

Interface definitions

type Url

export interface Url {
  id: string;
  domainName: string;
  sourceUrl: string;
  destinationUrl: string;
  visitCount: number;
  createdAt: moment.Moment;
};
{
  id: 'b4949c2b-8a76-44df-8c34-04ccad2f9fb8',
  domainName: 'nip.is',
  sourceUrl: 'https://nip.is/cXCUn',
  destinationUrl: 'https://root.co.za/careers',
  visitCount: 1,
  createdAt: moment("2019-05-27T20:48:48.519")
}

type Visit

export interface Visit {
  id: string;
  url_id: string;
  headers: any;
  createdAt: moment.Moment;
};
{
  id: '11bee574-626e-447f-9864-329c56756872',
  urlId: 'b4949c2b-8a76-44df-8c34-04ccad2f9fb8',
  headers: {
    host: 'nip.is',
    'user-agent':
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
    'cf-ipcountry': 'ZA',
    'x-forwarded-for': '41.56.11.31, 197.234.242.47',
    'cf-connecting-ip': '41.56.11.31',
    ...
  },
  createdAt: moment("2019-05-27T20:50:59.141"),
}

Created by Root.

FAQs

Package last updated on 29 May 2019

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