downloadDepotChunk

suspend fun downloadDepotChunk(depotId: Int, chunk: ChunkData, server: Server, destination: ByteArray, depotKey: ByteArray? = null, proxyServer: Server? = null, cdnAuthToken: String? = null): Int

Downloads the specified depot chunk, and optionally processes the chunk and verifies the checksum if the depot decryption key has been provided. This function will also validate the length of the downloaded chunk with the value of ChunkData.compressedLength, if it has been assigned a value.

Return

The total number of bytes written to destination.

Parameters

depotId

The id of the depot being accessed.

chunk

A ChunkData instance that represents the chunk to download. This value should come from a manifest downloaded with downloadManifest.

server

The content server to connect to.

destination

The buffer to receive the chunk data. If depotKey is provided, this will be the decompressed buffer. Allocate or rent a buffer that is equal or longer than ChunkData.uncompressedLength

depotKey

The depot decryption key for the depot that will be downloaded. This is used to process the chunk data.

proxyServer

Optional content server marked as UseAsProxy which transforms the request.

cdnAuthToken

CDN auth token for CDN content server endpoints if necessary. Get one with SteamContent.getCDNAuthToken.

Throws

Thrown if the chunk's ChunkData.chunkID was null or if the destination buffer is too small.

Thrown if the downloaded data does not match the expected length.

A network error occurred when performing the request.