Skip to content

Commit

Permalink
feat: Add addTorrentMagnet method (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellhuang authored and scttcper committed May 5, 2019
1 parent 807eb15 commit cb85fe4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ export class Deluge implements TorrentClient {
return res.body;
}

async addTorrentMagnet(magnet: string, config: Partial<AddTorrentOptions> = {}) {
const options: AddTorrentOptions = {
file_priorities: [],
add_paused: false,
compact_allocation: false,
max_connections: -1,
max_download_speed: -1,
max_upload_slots: -1,
max_upload_speed: -1,
prioritize_first_last_pieces: false,
// not passing path by default uses default
// download_location: '/root/Downloads',
// move_completed_path: '/root/Downloads',
...config,
};
const res = await this.request<BooleanStatus>('core.add_torrent_magnet', [magnet, options]);

return res.body;
}

/**
*
* @param torrentId torrent id from list torrents
Expand Down

0 comments on commit cb85fe4

Please sign in to comment.