# shorturl

> Simple URL shortener client library

Latest version **0.0.3** (published 2012-03-30) · 0 weekly downloads

## Install

```sh
npm install shorturl
pnpm add shorturl
yarn add shorturl
bun add shorturl
```

Provides the command `shorturl`.

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2012-03-30 |
| First published | 2011-02-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Jeff Waugh |
| Maintainers | jdub |
| Keywords | shorturl, shortlink, bit.ly, bitly, goo.gl, is.gd |

## Links

- npm: https://www.npmjs.com/package/shorturl
- Repository: https://github.com/jdub/node-shorturl
- Issues: https://github.com/jdub/node-shorturl/issues
- npm.io page: https://npm.io/package/shorturl

## Dependencies (2)

- [request](https://npm.io/package/request.md) >=2.9.153
- [optimist](https://npm.io/package/optimist.md) >=0.3.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.3 (latest) — 2012-03-30
- 0.0.2 — 2011-02-05
- 0.0.1 — 2011-02-04

## README

Simple URL shortener client library for node.js
===============================================

[shorturl](https://github.com/jdub/node-shorturl) is a simple, asynchronous client library for common URL shortener services. It currently supports: arseh.at, bit.ly, goo.gl, is.gd, v.gd and string substitution links (with %@). It includes a perky little script for shortening URLs on the command line, also named [shorturl](https://github.com/jdub/node-shorturl/blob/master/shorturl).

If you [need to go deeper](http://www.imdb.com/title/tt1375666/), try the more complete client libraries for individual services such as [node-bitly](https://github.com/tanepiper/node-bitly) or [node-googl](https://github.com/ukstv/node-googl).


## Requirements

You can install node-shorturl and its dependencies with npm: `npm install shorturl`. Otherwise, manually install:

- [node](http://nodejs.org/) 0.6+
- [request](https://github.com/mikeal/request) 2.9+
- [optimist](https://github.com/substack/node-optimist) 0.3.1

## Examples

	var shorturl = require('shorturl');
	shorturl('http://bethesignal.org/', function(result) {
		console.log(result);
	});

By default it will shorten URLs with is.gd, but you can choose an alternative service and pass parameters:

	shorturl('http://bethesignal.org/', 'bit.ly', {
		login: 'STATE YOUR NAME',
		apiKey: 'STATE YOUR IDENTIFICATION NUMBER'
	}, function(result) {
		console.log(result);
	});

Simple services can be described using a string substitution link. Pass the entire link as the service name; '%@' will be replaced with your URL:

	var arsehat = 'http://arseh.at/api.php?action=shorturl&format=simple&url=%@';
	shorturl('http://bethesignal.org/', arsehat, function(result) {
		console.log(result);
	});

## Command line script

	$ shorturl
	Usage: shorturl [options] <longurl>

	$ shorturl --service=goo.gl --key=STATE_YOUR_ID_NUMBER http://bethesignal.org/
	http://goo.gl/dgTLo

	$ ARSEHAT="http://arseh.at/api.php?action=shorturl&format=simple&url=%@"
	$ shorturl --service=$ARSEHAT https://github.com/jdub/node-shorturl
	http://arseh.at/3yd

Display the built-in command line documentation with `shorten --help`.

---
_Source: https://npm.io/package/shorturl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
