npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

short.io

v1.3.1

Published

Node wrapper for https://short.io API

Downloads

3,121

Readme

short.io (NodeJS Module)

Easy to use module, made to interact with the short.io API, shorten links, delete them & more.

DeepScan grade DeepSource

How to use short.io ?

Here's some exemple to kickstart your short.io integration, if you need documentation, refer to the GitHub Repository's Wiki.

IchiiDev/short.io is not affiliated to the website and enterprise short.io

Basics

If you want to use your short.io account with this package, here's some data you should get from your account:

  • domain: The full domain redirected on the short.io service, exemple: short.domain.com.
  • domainId: The ID of the managed domain, you can get it in the URL of the links panel, exemple: https://app.short.io/users/dashboard/00000/links < 00000.
  • api_key: Your account API Key, you can manage yours here: https://app.short.io/settings/integrations/api-key/ (Only use your private key and do not publish it).

Get a list of specific links from your domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This* gets a maximum of 150 links from your domain
short.getLinks().then(links => {
    console.log(links); // Print your links
});

*More options available on the package's wiki page

Get a precise link from the API

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This gets a precise link informations, the 00000 is the link ID.
short.getLink(00000).then(link => {
    console.log(link);
});

Push a link to your shortner domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This* creates a link on your short.io service.
short.createLink({ originalURL: "https://discord.gg/fr" }).then(link => {
    console.log(link);
});

*More options available on the package's wiki page

Delete a link from your shortner domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This deletes a link, the 00000 is the link ID.
short.deleteLink(00000) // Delete the link
    .then(result => console.log(result)) // Display the result for debug
    .catch(e => console.log(e)); // Catch error if one occures

How to contribute ?

Feel free to fork my work and propose changes. If you have any issues with my work, please open an Issue.

Contributors

What's new ?

v1.1.O: Security update

  • Changed request dependency package from request to node-fetch (request was deprecated).
  • Added promises to the deleteLink() and archiveLink() function.

v1.1.1: Documentation Update

  • Fixed the getLinks() function, added more parameters like offset, tag and limit.
  • Added more documentation to the code

v1.2.0: Link Management Update

  • Added the updateLink() function to permit link edition
  • Added the getByOriginalURL() function to get a link object by querying it's originalURL.
  • Removed useless functions parameters
  • Corrected JS Doc errors

v1.3.0: Statistics 🥳

  • Added domain, clicks and links stats methods
  • Fixed some code execution errors
  • Removed useless constants from the code

What's coming ?

  • [ ] Add more classes to improve package ergonomics => V2 (TypeScript)
  • [ ] Global rewrite of the package in TS to improve documentation and code quality + user ergonomic => V2

V2 will come directly as the next update, there wont be any 1.4.0 for domain management (Theses methods will be added along with the V2)