pub struct TorrentInfo {
pub files: Option<TorrentFiles>,
pub length: Option<usize>,
pub name: String,
pub piece_length: usize,
pub pieces: Vec<u8>,
}
Fields§
§files: Option<TorrentFiles>
a list of dictionaries each corresponding to a file (only when multiple files are being shared)
length: Option<usize>
size of the file in bytes (only when one file is being shared)
name: String
suggested filename where the file is to be saved (if one file) suggested directory name where the files are to be saved (if multiple files)
piece_length: usize
number of bytes per piece. This is commonly 2^8 KiB = 256 KiB = 262,144 B
pieces: Vec<u8>
i.e., a concatenation of each piece’s SHA-1 hash. As SHA-1 returns a 160-bit hash, pieces will be a string whose length is a multiple of 20 bytes. If the torrent contains multiple files, the pieces are formed by concatenating the files in the order they appear in the files dictionary (i.e. all pieces in the torrent are the full piece length except for the last piece, which may be shorter).