Comparing version 0.0.6 to 1.0.0
{ | ||
"name": "aria2", | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"description": "Library for aria2, \"The next generation download utility.\"", | ||
"homepage": "https://github.com/sonnyp/aria2.js", | ||
"bugs": "https://github.com/sonnyp/aria2.js/issues", | ||
"license": "MIT", | ||
"license": "ISC", | ||
"author": "Sonny Piers <sonny@fastmail.net>", | ||
@@ -12,27 +12,30 @@ "keywords": [ | ||
"download", | ||
"bittorrent" | ||
"BitTorrent", | ||
"HTTP", | ||
"HTTPS", | ||
"FTP", | ||
"SFTP", | ||
"MetaLink", | ||
"magnet", | ||
"torrent" | ||
], | ||
"engines": { | ||
"node": ">=0.8.0" | ||
}, | ||
"scripts": { | ||
"test": "grunt test --verbose" | ||
"preversion": "npm test", | ||
"lint": "./node_modules/.bin/eslint .", | ||
"unit": "mocha test/unit.js", | ||
"integration": "mocha test/integration.js", | ||
"test": "npm run unit && npm run lint" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/sonnyp/aria2.js.git" | ||
}, | ||
"main": "lib/", | ||
"repository": "github:sonnyp/aria2.js", | ||
"main": "Aria2.js", | ||
"dependencies": { | ||
"ws": "^0.4.31", | ||
"httpclient": "0.0.3" | ||
"ws": "^0.8.0", | ||
"httpclient": "0.0.4" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^1.18.2", | ||
"grunt": "^0.4.4", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-concat": "^0.4.0", | ||
"grunt-contrib-uglify": "^0.4.0", | ||
"grunt-mocha-test": "^0.10.2" | ||
"chai": "^3.2.0", | ||
"eslint": "^0.24.1", | ||
"sinon": "^1.15.4", | ||
"sinon-chai": "^2.8.0" | ||
} | ||
} |
155
README.md
@@ -6,32 +6,91 @@ aria2.js | ||
[![Build Status](https://travis-ci.org/sonnyp/aria2.js.png?branch=master)](https://travis-ci.org/sonnyp/aria2.js) | ||
[![Build Status](https://img.shields.io/travis/sonnyp/aria2.js/master.svg?style=flat-square)](https://travis-ci.org/sonnyp/aria2.js/branches) | ||
[![Code quality](https://img.shields.io/codeclimate/github/kabisaict/flow.svg?style=flat-square)](https://codeclimate.com/github/sonnyp/aria2.js) | ||
[![Dependency Status](https://david-dm.org/sonnyp/aria2.js.png)](https://david-dm.org/sonnyp/aria2.js) | ||
[![devDependency Status](https://david-dm.org/sonnyp/aria2.js/dev-status.png)](https://david-dm.org/sonnyp/aria2.js#info=devDependencies) | ||
[![Dependency Status](https://img.shields.io/david/sonnyp/aria2.js.svg?style=flat-square)](https://david-dm.org/sonnyp/aria2.js) | ||
[![devDependency Status](https://img.shields.io/david/dev/sonnyp/aria2.js.svg?style=flat-square)](https://david-dm.org/sonnyp/aria2.js#info=devDependencies) | ||
## Intro | ||
aria2.js controls aria2 via its [JSON-RPC interface](http://aria2.sourceforge.net/manual/en/html/aria2c.html#rpc-interface) and supports WebSocket, HTTP and JSONP transports. | ||
aria2.js supports the WebSocket, HTTP and JSONP transports. | ||
- [Getting started](#getting-started) | ||
- [Usage](#usage) | ||
- [open](#open) | ||
- [close](#close) | ||
- [onsend and onmessage](#onsend-and-onmessage) | ||
- [aria2 methods](#aria2-methods) | ||
- [addUri](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.addUri) | ||
- [addTorrent](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.addTorrent) | ||
- [addMetaLink](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.addMetalink) | ||
- [remove](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.remove) | ||
- [forceRemove](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.forceRemove) | ||
- [pause](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.pause) | ||
- [pauseAll](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.pauseAll) | ||
- [forcePause](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.forcePause) | ||
- [forcePauseAll](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.forcePauseAll) | ||
- [unpause](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.unpause) | ||
- [unpauseAll](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.unpauseAll) | ||
- [tellStatus](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.tellStatus) | ||
- [getUris](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getUris) | ||
- [getFiles](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getFiles) | ||
- [getPeers](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getPeers) | ||
- [getServers](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getServers) | ||
- [tellActive](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.tellActive) | ||
- [tellWaiting](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.tellWaiting) | ||
- [tellStopped](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.tellStopped) | ||
- [changePosition](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.changePosition) | ||
- [changeUri](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.changeUri) | ||
- [getOption](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getOption) | ||
- [changeOption](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.changeOption) | ||
- [getGlobalOption](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getGlobalOption) | ||
- [changeGlobalOption](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.changeGlobalOption) | ||
- [getGlobalStat](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getGlobalStat) | ||
- [purgeDownloadResult](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.purgeDownloadResult) | ||
- [removeDownloadResult](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.removeDownloadResult) | ||
- [getVersion](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getVersion) | ||
- [getSessionInfo](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.getSessionInfo) | ||
- [shutdown](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.shutdown) | ||
- [forceShutdown](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.forceShutdown) | ||
- [saveSession](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.saveSession) | ||
- [aria2 events](#aria2-events) | ||
- [onDownloadStart](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onDownloadStart) | ||
- [onDownloadPause](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onDownloadPause) | ||
- [onDownloadStop](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onDownloadStop) | ||
- [onDownloadComplete](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onDownloadComplete) | ||
- [onDownloadError](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onDownloadError) | ||
- [onBtDownloadComplete](http://aria2.sourceforge.net/manual/en/html/aria2c.html#aria2.onBtDownloadComplete) | ||
- [Example](#example) | ||
- [Contributing](#contributing) | ||
### Browser | ||
# Getting started | ||
```npm install aria2``` | ||
---- | ||
```javascript | ||
var Aria2 = require('aria2'); | ||
``` | ||
bower install aria2 | ||
``` | ||
or | ||
```xml | ||
<script src="bower_components/aria2/dist/aria2.min.js"></script> | ||
<script src="node_modules/aria2/lib/index.js"></script> | ||
``` | ||
### Node.js | ||
``` | ||
npm install aria2 | ||
``` | ||
```javascript | ||
var Aria2 = require('aria2'); | ||
var Aria2 = window.Aria2 | ||
``` | ||
## Init | ||
[↑](#aria2js) | ||
# Usage | ||
```javascript | ||
var aria2 = new Aria2([options]); | ||
``` | ||
default options are | ||
```javascript | ||
@@ -48,8 +107,11 @@ { | ||
## Open | ||
[↑](#aria2js) | ||
aria2.open() will open the WebSocket connexion. | ||
## open | ||
```aria2.open()``` opens the WebSocket connection. | ||
```javascript | ||
aria2.onopen = function() { | ||
console.log('I\'m open!'); | ||
console.log('aria2 open'); | ||
}; | ||
@@ -59,8 +121,11 @@ aria2.open(); | ||
## Close | ||
[↑](#aria2js) | ||
aria2.close() will close the WebSocket connexion. | ||
## close | ||
```aria2.close()``` closes the WebSocket connection. | ||
```javascript | ||
aria2.onclose = function() { | ||
console.log('I\'m closed!'); | ||
console.log('aria2 closed!'); | ||
}; | ||
@@ -70,15 +135,21 @@ aria2.close(); | ||
[↑](#aria2js) | ||
## onsend and onmessage | ||
onsend() is called everytime a message is being sent, onmessage() is called everytime a message has been received. | ||
```aria2.onsend()``` is called everytime a message is being sent | ||
```aria2.onmessage()``` is called everytime a message has been received. | ||
```javascript | ||
aria2.onsend = function(m) { | ||
console.log('OUT', m); | ||
console.log('aria2 OUT', m); | ||
}; | ||
aria2.onmessage = function(m) { | ||
console.log('IN', m); | ||
console.log('aria2 IN', m); | ||
}; | ||
``` | ||
## Methods | ||
[↑](#aria2js) | ||
## aria2 methods | ||
For a complete listing see [aria2 methods](http://aria2.sourceforge.net/manual/en/html/aria2c.html#methods). | ||
@@ -88,5 +159,6 @@ | ||
When sending a request to aria2, if the WebSocket isn't available or closed, aria2.js will use the HTTP transport. | ||
When sending a request to aria2, if the WebSocket is closed, aria2.js will use the HTTP transport. | ||
For every aria2 methods you can use | ||
```javascript | ||
@@ -97,3 +169,5 @@ aria2.getVersion([params,] function(err, res) { | ||
``` | ||
or | ||
```javascript | ||
@@ -105,6 +179,9 @@ aria2.send('getVersion', [params,] function(err, res) { | ||
## Notifications | ||
[↑](#aria2js) | ||
## aria2 events | ||
For a complete listing see [aria2 notifications](http://aria2.sourceforge.net/manual/en/html/aria2c.html#json-rpc-over-websocket). | ||
For every notifications you can bind a function. | ||
```javascript | ||
@@ -116,3 +193,23 @@ aria2.onDownloadStart = function(gid) { | ||
## Example | ||
[↑](#aria2js) | ||
# Example | ||
See [example.js](https://github.com/sonnyp/aria2.js/blob/master/example/example.js) | ||
[↑](#aria2js) | ||
# Tests | ||
``` | ||
npm install -g eslint mocha babel | ||
npm test | ||
``` | ||
[↑](#aria2js) | ||
# Contributing | ||
See [CONTRIBUTING.md](https://github.com/sonnyp/aria2.js/blob/master/CONTRIBUTING.md) | ||
[↑](#aria2js) |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17542
4
236
0
208
1
2
+ Addedbindings@1.2.1(transitive)
+ Addedbufferutil@1.2.1(transitive)
+ Addedes6-promise@1.0.0(transitive)
+ Addedhttpclient@0.0.4(transitive)
+ Addednan@2.22.02.4.0(transitive)
+ Addedultron@1.0.2(transitive)
+ Addedutf-8-validate@1.2.2(transitive)
+ Addedws@0.8.1(transitive)
- Removedcommander@2.1.0(transitive)
- Removedhttpclient@0.0.3(transitive)
- Removednan@1.0.0(transitive)
- Removedtinycolor@0.0.1(transitive)
- Removedws@0.4.32(transitive)
Updatedhttpclient@0.0.4
Updatedws@^0.8.0