Method Create
Create(string, long, Func<long, Memory<byte>, CancellationToken, ValueTask<int>>, string?)
Creates a source whose reads call the specified function.
Declaration
public static UploadSource Create(string fileName, long length, Func<long, Memory<byte>, CancellationToken, ValueTask<int>> readAsync, string? contentType = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The name of the file, which the service receives. |
| long | length | The length of the content in bytes. |
| Func<long, Memory<byte>, CancellationToken, ValueTask<int>> | readAsync | A function that reads bytes of the content from an offset into a buffer and returns how many it read, as ReadAsync(long, Memory<byte>, CancellationToken) does. |
| string | contentType | The content type of the file, such as |
Returns
| Type | Description |
|---|---|
| UploadSource |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentOutOfRangeException |
|