Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add addTorrentMagnet method #17

Merged
merged 1 commit into from
May 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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