Comparing version 4.0.2 to 4.0.3
{ | ||
"editor.formatOnSave": true | ||
} | ||
"editor.formatOnSave": true | ||
} |
@@ -12,3 +12,3 @@ "use strict"; | ||
const WebSocket = global.WebSocket || _WebSocket; | ||
const fetch = global.fetch || _fetch; | ||
const fetch = global.fetch ? global.fetch.bind(global) : _fetch; | ||
@@ -40,3 +40,3 @@ class JSONRPCClient extends EventEmitter { | ||
async websocket(message) { | ||
websocket(message) { | ||
return new Promise((resolve, reject) => { | ||
@@ -53,3 +53,3 @@ const cb = err => { | ||
async http(message) { | ||
const fetch = this.fetch(this.url("http"), { | ||
const response = this.fetch(this.url("http"), { | ||
method: "POST", | ||
@@ -63,7 +63,7 @@ body: JSON.stringify(message), | ||
fetch.then(async res => { | ||
response.then(async res => { | ||
this._onmessage(await res.json()); | ||
}); | ||
return await fetch; | ||
return response; | ||
} | ||
@@ -70,0 +70,0 @@ |
{ | ||
"name": "aria2", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "Library and cli for aria2, \"The next generation download utility.\"", | ||
@@ -32,9 +32,9 @@ "homepage": "https://github.com/sonnyp/aria2.js", | ||
"dependencies": { | ||
"commander": "^2.16.0", | ||
"node-fetch": "^2.1.2", | ||
"ws": "^5.2.2" | ||
"commander": "^2.17.1", | ||
"node-fetch": "^2.2.0", | ||
"ws": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"prettier": "1.13.7" | ||
"prettier": "1.14.2" | ||
}, | ||
@@ -41,0 +41,0 @@ "engines": { |
@@ -43,14 +43,10 @@ # aria2.js | ||
Start aria2c in daemon mode with | ||
Start aria2 with rpc, example: | ||
`aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all` | ||
Install aria2 | ||
Install aria2.js | ||
`npm install aria2` | ||
```javascript | ||
const Aria2 = require("aria2"); | ||
``` | ||
[↑](#aria2js) | ||
@@ -61,2 +57,3 @@ | ||
```javascript | ||
const Aria2 = require("aria2"); | ||
const aria2 = new Aria2([options]); | ||
@@ -199,3 +196,3 @@ ``` | ||
// emitted when the WebSocket is open. | ||
aria2.on('open' () => { | ||
aria2.on('open', () => { | ||
console.log('aria2 OPEN'); | ||
@@ -205,3 +202,3 @@ }); | ||
// emitted when the WebSocket is closed. | ||
aria2.on('close' () => { | ||
aria2.on('close', () => { | ||
console.log('aria2 CLOSE'); | ||
@@ -208,0 +205,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69005
22
1545
223
3
5
+ Addedws@6.2.3(transitive)
- Removedws@5.2.4(transitive)
Updatedcommander@^2.17.1
Updatednode-fetch@^2.2.0
Updatedws@^6.0.0