FileStorage
The set of files in a torrent and the geometry that ties them to pieces: port of libtorrent's file_storage. For a single-file torrent there is exactly one entry whose path is the torrent name.
Properties
Functions
The file index that owns the byte range at the start of piece piece: port of file_storage::file_index_at_piece. For v2/hybrid (piece-aligned) torrents this is the file the whole piece belongs to. Returns -1 for an out-of-range piece or when there are no files. Pad files are included (they occupy real pieces in the layout).
Alias matching libtorrent's file_index_at_piece.
Number of v2 pieces in file fileIndex: port of file_storage::file_num_pieces. Equivalent to numPiecesInFile but computed from the file size alone (independent of the concatenated-stream offset), matching how v2 per-file trees are laid out.
The piece index this file starts on (file_offset / piece_length).
Number of 16 KiB merkle leaf blocks in file fileIndex: port of file_storage::file_num_blocks. Rounds the file size up to whole blocks.
Number of pieces (partial pieces counted) that file fileIndex spans.
The piece-layer offset of file fileIndex's piece pieceInFile within that file's tree.
The piece range covering file fileIndex, inclusive at both ends. The range runs from the piece holding the file's first byte to the piece holding its last byte. This is analogous to file_storage::file_piece_range. A zero-length file returns IntRange.EMPTY.