Class OpenBiApiFile
- Namespace
- BiExcellence.OpenBi.Api
- Assembly
- BiExcellence.OpenBi.Api.Client.dll
A file the server returned: the response body, plus the media type and file name it stated. Disposing it disposes the underlying response, so read Content before letting it go.
public sealed class OpenBiApiFile
- Inheritance
-
objectOpenBiApiFile
Constructors
OpenBiApiFile(Stream, string?, string?, long?)
Creates a file over an already opened response stream.
public OpenBiApiFile(Stream content, string? mediaType, string? fileName, long? length)
Parameters
contentStreamThe response body. Owned by this instance.
mediaTypestringThe media type the server stated, if any.
fileNamestringThe file name the server stated, if any.
lengthlong?The content length the server stated, if any.
Properties
Content
The file's bytes.
public Stream Content { get; }
Property Value
- Stream
FileName
The file name the server suggested, where it sent a Content-Disposition header.
public string? FileName { get; }
Property Value
- string
Length
The content length, where the server stated one.
public long? Length { get; }
Property Value
- long?
MediaType
The media type, e.g. application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
public string? MediaType { get; }
Property Value
- string
Methods
Dispose()
Disposes the response the file was read from.
public void Dispose()
ReadAllBytesAsync(CancellationToken)
Reads the whole file into memory. The stream is consumed, so this can only be done once.
public Task<byte[]> ReadAllBytesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
- Task<byte[]>