Skip to main content

LtAddTorrentParams

The LtAddTorrentParams is a pure Lua table - i.e it does not wrap a type.

The main reason for this is that wrapping it makes it quite hard to work with the different tables associated with the params, such as trackers, file priorities, etc.

This has the consequence that no actual type checking is done until the table is handed over to the C++ side and it is converted to a real object.

Factories​

from_buffer(buffer: string): LtAddTorrentParams | nil, PoError | nil​

Creates a params object from a torrent file buffer. Returns nil, err with a decode_error when the buffer isn't a valid torrent file.

Changed in v0.55.0
The error code was invalid_params.

from_magnet(uri: string): LtAddTorrentParams | nil, PoError | nil​

Creates a params object from a magnet URI. Returns nil, err with a decode_error when the URI isn't a valid magnet link.

Changed in v0.55.0
The error code was invalid_params.

from_path(path: string): LtAddTorrentParams | nil, PoError | nil​

v0.42.0

Creates a params object from a file path. Returns nil, err with an io_error when the file can't be read, and a decode_error when it isn't a valid torrent file.

Changed in v0.55.0
Both error codes were invalid_params.

Example​

local params, err = LtAddTorrentParams.from_path("/tmp/debian.torrent")

if err then
print("Failed to load torrent file", err)
return
end

print("Loaded torrent", params.name)

Properties​

active_time: number​

v0.42.0

added_time: number​

v0.42.0

comment: string​

v0.42.0

completed_time: number​

v0.42.0

created_by: string​

v0.42.0

creation_date: number​

v0.42.0

download_limit: number​

v0.42.0

file_priorities: number[]​

v0.42.0

finished_time: number​

v0.42.0

flags: LtTorrentFlags​

v0.42.0

info_hash: LtInfoHash​

v0.42.0

last_download: number​

v0.42.0

last_seen_complete: number​

v0.42.0

last_upload: number​

v0.42.0

max_connections: number​

v0.42.0

max_uploads: number​

v0.42.0

name: string​

v0.42.0

num_complete: number​

v0.42.0

num_downloaded: number​

v0.42.0

num_incomplete: number​

v0.42.0

part_file_dir: string​

v0.42.0

root_certificate: string​

v0.42.0

save_path: string​

v0.42.0

seeding_time: number​

v0.42.0

storage_mode: string​

v0.42.0

ti: LtTorrentInfo​

v0.42.0

trackerid: string​

v0.42.0

tracker_tiers: number[]​

v0.42.0
Changed in v0.51.1

Now honored when adding.

Sets the tiers for the trackers. Must be an integer array, each value must be 0 or more. Cannot have more entries than the trackers array.

trackers: string[]​

v0.42.0

total_downloaded: number​

v0.42.0

total_uploaded: number​

v0.42.0

upload_limit: number​

v0.42.0

url_seeds: string[]​

v0.42.0

userdata: {category?, tags?, metadata?}​