Stream Module
Bounded stream copy utilities.
Types
| Type | Description |
|
The outcome of copyUpTo when the source produced more bytes than the configured limit. |
Functions and values
| Function or value |
Description
|
||
Full Usage:
Stream.copyUpTo maxBytes destination cancellationToken source
Parameters:
int64
-
The maximum number of bytes allowed to be read from source.
destination : Stream
-
The stream to write to. Not disposed by this function.
cancellationToken : CancellationToken
-
Token observed on every read and write.
source : Stream
-
The stream to read from. Not disposed by this function.
Returns: Task<Result<int64, MaxBytesExceeded>>
|
Copies source into destination, stopping and returning
Uses an 81920-byte buffer rented from Shared, always
returned in a Deviates from the usual "null collection is empty" policy: a null stream cannot stand in for an empty one without silently changing where bytes go (a null destination would silently discard writes), so a null source or destination is treated like a null function argument — a programmer error that throws immediately, before any I/O or task is started.
Example
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
union case Result.Error: ErrorValue: 'TError -> Result<'T,'TError>
val failwithf: format: Printf.StringFormat<'T,'Result> -> 'T
|
TDesu.FSharp