Socket
Socket
Sign inDemoInstall

abird.co

Package Overview
Dependencies
48
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abird.co

Simple wrapper for the aBird.co API -The world's most awesome content shortening service.


Version published
Weekly downloads
11
decreased by-38.89%
Maintainers
1
Install size
4.65 MB
Created
Weekly downloads
 

Readme

Source

aBird.co

Build Status Dependencies

NPM

NPM

Simple wrapper for the aBird.co API -The world's most awesome content shortening service. Please make sure you visit (and read) the API documentation for more specific details.

Using this module can't be made any easier:

Install aBird.co

npm install abird.co

Require aBird.co

var abird = require('abird.co').fly(options);

The options object may contain:

  • env - Which environment is being used; PRO or DEV. Defaults to PRO.
  • apiKey - Your API key, obtained from your aBird.co profile page. Providing an API key is only required when using the shrink method.
  • timeout - API request timeout, in milliseconds. Defaults to 3600.

And you are ready to use this awesome API.

API

  • .shrink(object, callback)
  • .expand(mask, callback)
  • .stats(mask, callback)
  • .delete(mask [, deleteType], callback)

In all cases the callback has this signature:

function(err, data) {

}

Some examples

The examples listed in this document assume that Express is being used.
Shrink content
var content = {
	"data": {
		"type": "url",
		"value": "http://abird.co"
	}
};

abird.shrink(content, function(err, data) {
	if (err) {
		return next(err);
	}

	res.send(data);
});
Expand content
var mask = 'a';
abird.expand(mask, function(err, data) {
	if (err) {
		return next(err);
	}

	if (!data) {
		res.status(404).end();
	} else {
		res.redirect(302, data.value);
	}
});
Basic content statistics
var mask = 'a';
abird.stats(mask, function(err, data) {
	if (err) {
		return next(err);
	}

	if (!data) {
		res.status(404).end();
	} else {
		res.send(data);
	}
});
Delete content
var mask = 'a';
abird.delete(mask, 'soft', function(err, data) {
	if (err) {
		return next(err);
	}

	res.status(200).end();
});

Keywords

FAQs

Last updated on 04 Sep 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc