New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aria2

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aria2

Library for aria2, "The next generation download utility."

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
316
increased by30.58%
Maintainers
1
Weekly downloads
 
Created
Source

aria2.js

JavaScript (Node.js and browsers) library for aria2, "The next generation download utility."

Build Status

Dependency Status devDependency Status

Intro

aria2.js supports the WebSocket, HTTP and JSONP transports.

Browser

bower install aria2
<script src="bower_components/aria2/dist/aria2.min.js"></script>

Node.js

npm install aria2
var Aria2 = require('aria2');

Init

var aria2 = new Aria2([options]);

default options are

{
  host: 'localhost',
  port: 6800,
  secure: false,
  secret: ''
}

Secret is optional and refers to --rpc-secret.

Open

aria2.open() will open the WebSocket connexion.

aria2.onopen = function() {
  console.log('I\'m open!');
};
aria2.open();

Close

aria2.close() will close the WebSocket connexion.

aria2.onclose = function() {
  console.log('I\'m closed!');
};
aria2.close();

onsend and onmessage

onsend() is called everytime a message is being sent, onmessage() is called everytime a message has been received.

aria2.onsend = function(m) {
  console.log('OUT', m);
};
aria2.onmessage = function(m) {
  console.log('IN', m);
};

Methods

For a complete listing see aria2 methods.

Note that if you have passed the secret option to aria2.js, it will be automatically added it to every request so there is no need to include it.

When sending a request to aria2, if the WebSocket isn't available or closed, aria2.js will use the HTTP transport.

For every aria2 methods you can use

aria2.getVersion([params,] function(err, res) {
  console.log(err || res);
});

or

aria2.send('getVersion', [params,] function(err, res) {
  console.log(err || res);
});

Notifications

For a complete listing see aria2 notifications.

For every notifications you can bind a function.

aria2.onDownloadStart = function(gid) {
  console.log(gid);
};

Example

See example.js

Keywords

FAQs

Package last updated on 13 Apr 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc