shaveurl
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published
shaveurl Logo

shaveurl: URL Shortener Services

shaveurl is an npm package that provides easy integration with four URL shortener services that don't require API access tokens. You can easily shorten URLs using CleanUri, IsGd, 1pt, or shrtcode. Additionally, shaveurl comes with a command-line interface, enabling users to shorten URLs directly from the command line.

Quick try

You can use shaveurl directly from the command line using npx:

npx shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'

Table of Contents

  1. Getting Started
  2. Services Included
  3. Usage
  4. Custom Shortlink
  5. Contribution
  6. License

Getting Started

Installation

You can install shaveurl locally for use in your project:

npm:

npm install shaveurl

yarn:

yarn add shaveurl

pnpm:

pnpm install shaveurl

Services Included

  1. CleanUri
  2. IsGd
  3. 1pt
  4. shrtcode

Usage

Library Usage

Import the `shortenUrl` function from the package and specify one of the four shortening services: cleanuri, isgd, 1pt, or shrtcode. If no service is specified, the default service is isgd.

Example

import { shortenUrl } from 'shaveurl';

const longUrl = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes";
shortenUrl(longUrl).then(shortUrl => console.log(shortUrl));

with custom service:

import { shortenUrl } from 'shaveurl';
const longUrl = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes";
shortenUrl(longUrl, "cleanuri").then(shortUrl => console.log(shortUrl));

Command Line Usage

You can use shaveurl directly from the command line using npx:

npx shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'

Alternatively, you can install shaveurl globally for faster command line usage:

npm install -g shaveurl

Example with default service:

shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'

Example with specified service:

shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes' cleanuri

For help with command line options, run:

shaveurl --help

Custom Shortlink

Specify a custom shortlink with isgd or 1pt:

const customShort = 'myshrinklink';
const url = 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes';

shortenUrl(longUrl, "isgd", customShort).then(shortUrl => console.log(shortUrl));

Contribution

Feel free to contribute to the shaveurl GitHub repository.

License

shaveurl is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i shaveurl

Weekly Downloads

46

Version

1.1.7

License

MIT

Unpacked Size

1.05 MB

Total Files

26

Last publish

Collaborators

  • eqaderi