node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


shorten-anonymize-url Beta npm dependencies devDependencies

Shorten and anonymize (derefer) URLs at the same time.
Supports Commandline and programmatic usage.
Uses, and under the hood.

Enables right-click URL shortening on macOS.
Includes the required Automator Service and installation toolset.

Available for macOS, Windows and Linux.


  1. Commandline Usage
  2. 'Right-Click' URL Shortener (macOS)
  3. Programmatic Usage
  4. Platform Support
  5. Roadmap
  6. Contribute
  7. Author

Commandline Usage


$ npm install --global shorten-anonymize-url


$ shorten-anonymize-url "<url>"

⚠️ Enclose URLs in quotes to handle special characters like as question marks ⚠️

Show Help and Options

$ shorten-anonymize-url --help


$ shorten-anonymize-url ""

Right-Click URL Shortener (macOS only)


The module includes a global Service for macOS Automator, as well as an automated installation and uninstallation routine.


The global shortener service does the following:

  1. It takes any marked url within macOS,
  2. shortens and anonymizes it,
  3. copies the resulting shortened and anonymized URL to the macOS clipboard.

This enables global url shortening and anonymizing.


The global nature of macOS Services makes this module available to nearly all macOS apps, such as Safari, Finder, Google Chrome or Microsoft Office for Mac.

Requirements for the macOS Service

Install the commandline module.

Install the macOS Service

Run the commandline module with the --service-install argument:

$ shorten-anonymize-url --service-install

Uninstall the macOS Service

Run the commandline module with the --service-uninstall argument:

$ shorten-anonymize-url --service-uninstall

Use the macOS Service

  1. Mark any URL (or any text),
  2. right-click,
  3. open the 'Services' menu,
  4. Click 'shorten-anonymize-url'

The clipboard now contains the shortened and anonymized URL.

Programmatic Usage


$ npm install --save shorten-anonymize-url


The module returns a Function which takes 3 arguments and returns a Promise:

const shortenAnonymizeUrl = require('shorten-anonymize-url')
shortenAnonymizeUrl(url, bitlyKey, googlKey)
.then((shorturl) => {
  • url String - Bundle identifier for the callback function
  • bitlyKey [optional] String - API key
  • googlKey [optional] String - API key

The Promise resolves with:

  • shorturl String - Shortened anonymised url


const shortenAnonymizeUrl = require('shorten-anonymize-url')
.then((url) => {
.catch((err) => {

Platform Support

Tested on:

  • macOS Sierra
  • Windows 10 Anniversary
  • Ubuntu 17.10

Global 'Right-Click' url shortening only supported on macOS for now.

Roadmap img

  • Global Right-Click URL shortening for Windows + Linux
  • CI-based automated Testing

Contribute Contribute

Read the contribution documentation first.

  • Dev Chat: Talk about features and suggestions.
  • Issues File bugs and document issues.


sidneys 2017