fileForPiece

fun fileForPiece(piece: Int): Int

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).