Method WriteChunkAsync
WriteChunkAsync(UploadRecord, int, Stream, CancellationToken)
Writes a chunk of an upload, replacing the chunk if it was already written, unless the run of the upload's handler is claimed or the upload has an outcome. The chunk is reported as received once this returns Written. The upload's LastWriteUtc is the time when a write starts, and again when it ends.
Declaration
ValueTask<ChunkWriteResult> WriteChunkAsync(UploadRecord upload, int index, Stream content, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| UploadRecord | upload | The record of the upload. |
| int | index | The index of the chunk. |
| Stream | content | The chunk's bytes, which are GetChunkLength(int) bytes long. Reading it throws when the request does not have exactly that many bytes, and the chunk is then left missing. It reads the request's body, which a synchronous read reads synchronously, as the server allows for any body. |
| CancellationToken | cancellationToken | A token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<ChunkWriteResult> | Whether the chunk was written, or why not. |