Needlessly Postulating Minds
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

shortened

1.0.0 • Public • Published

shortened

A Node.js wrapper for shortening and unshortening URLs.

installation

$ npm i shortened

docs

shorten

Shorten a full-sized URL! (currently only supports tinyurl)

const shortened = require('shortened');
 
shortened.shorten('https://google.com', function(res){
    console.log(res);
    // http://tinyurl.com/cucpjq
});

unshorten

Turn a shortened URL into a full-sized one! (uses the (unshorten.me)[https://unshorten.me/] API)

You can not give a URL with http:// or https:// in it, because of how the (unshorten.me)[https://unshorten.me/] API works. You will be given an error if you try to leave it in.

const shortened = require('shortened');
 
shortened.unshorten('tinyurl.com/cucpjq', function(res){
 
```js
const shortened = require('shortened');
 
shortened.unshorten('https://tinyurl.com/cucpjq', function(res){
    console.log(res);
    // [shortened] ERROR! You shouldn't give shortened a url with https:// or http:// in it to unshorten. Try again without https:// or http:///
})

Keywords

none

install

npm i shortened

Downloadsweekly downloads

9

version

1.0.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability