@ctrl/deluge
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -60,2 +60,9 @@ /// <reference types="node" /> | ||
upload(torrent: string | Buffer): Promise<UploadResponse>; | ||
/** | ||
* Download a torrent from url, pass the result to {@link Deluge.addTorrent} | ||
* @param url | ||
* @param cookies | ||
* @returns file path | ||
*/ | ||
downloadFromUrl(url: string, cookies?: string): Promise<string>; | ||
addTorrent(torrent: string | Buffer, config?: Partial<AddTorrentOptions>): Promise<AddTorrentResponse>; | ||
@@ -62,0 +69,0 @@ normalizedAddTorrent(torrent: string | Buffer, options?: Partial<NormalizedAddTorrentOptions>): Promise<NormalizedTorrent>; |
@@ -179,2 +179,15 @@ "use strict"; | ||
} | ||
/** | ||
* Download a torrent from url, pass the result to {@link Deluge.addTorrent} | ||
* @param url | ||
* @param cookies | ||
* @returns file path | ||
*/ | ||
async downloadFromUrl(url, cookies = '') { | ||
const res = await this.request('web.download_torrent_from_url', [url, cookies]); | ||
if (!res.body.result) { | ||
throw new Error('Failed to download torrent'); | ||
} | ||
return res.body.result; | ||
} | ||
async addTorrent(torrent, config = {}) { | ||
@@ -181,0 +194,0 @@ const upload = await this.upload(torrent); |
{ | ||
"name": "@ctrl/deluge", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "TypeScript api wrapper for deluge using got", | ||
@@ -24,3 +24,3 @@ "author": "Scott Cooper <scttcper@gmail.com>", | ||
"build": "tsc -p tsconfig.build.json", | ||
"build:docs": "typedoc --out docs --hideGenerator --target ES6 --mode file src && touch docs/.nojekyll", | ||
"build:docs": "typedoc", | ||
"test": "jest --runInBand", | ||
@@ -32,18 +32,18 @@ "test:watch": "jest --watch --runInBand", | ||
"@ctrl/shared-torrent": "^3.0.4", | ||
"@ctrl/url-join": "^1.0.2", | ||
"form-data": "^3.0.0", | ||
"got": "^11.8.1", | ||
"@ctrl/url-join": "^1.0.4", | ||
"form-data": "^4.0.0", | ||
"got": "^11.8.2", | ||
"tough-cookie": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "7.12.1", | ||
"@babel/preset-typescript": "7.12.7", | ||
"@ctrl/eslint-config": "1.2.8", | ||
"@babel/plugin-transform-modules-commonjs": "7.13.8", | ||
"@babel/preset-typescript": "7.13.0", | ||
"@ctrl/eslint-config": "1.3.4", | ||
"@jest/globals": "26.6.2", | ||
"@types/node": "14.14.13", | ||
"@types/node": "14.14.41", | ||
"@types/tough-cookie": "4.0.0", | ||
"jest": "26.6.3", | ||
"p-wait-for": "3.1.0", | ||
"typedoc": "0.19.2", | ||
"typescript": "4.1.3" | ||
"p-wait-for": "3.2.0", | ||
"typedoc": "0.20.35", | ||
"typescript": "4.2.4" | ||
}, | ||
@@ -50,0 +50,0 @@ "jest": { |
40132
1155
+ Addedform-data@4.0.1(transitive)
- Removedform-data@3.0.2(transitive)
Updated@ctrl/url-join@^1.0.4
Updatedform-data@^4.0.0
Updatedgot@^11.8.2