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.
You can use shaveurl directly from the command line using npx:
npx shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'You can install shaveurl locally for use in your project:
npm:
npm install shaveurlyarn:
yarn add shaveurlpnpm:
pnpm install shaveurlImport the `shaveUrl` 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.
import { shaveUrl } from 'shaveurl';
const longUrl = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes";
shaveUrl(longUrl).then(shortUrl => console.log(shortUrl));with custom service:
import { shaveUrl } from 'shaveurl';
const longUrl = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes";
shaveUrl(longUrl, "cleanuri").then(shortUrl => console.log(shortUrl));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 shaveurlshaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes'shaveurl 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes' cleanuriFor help with command line options, run:
shaveurl --helpSpecify a custom shortlink with isgd or 1pt:
const customShort = 'myshrinklink';
const url = 'https://en.wikipedia.org/wiki/List_of_HTTP_status_codes';
shaveUrl(longUrl, "isgd", customShort).then(shortUrl => console.log(shortUrl));Feel free to contribute to the shaveurl GitHub repository.
shaveurl is licensed under the MIT License - see the LICENSE file for details.