Table of Contents

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
object
OpenBiApiFile

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

content Stream

The response body. Owned by this instance.

mediaType string

The media type the server stated, if any.

fileName string

The file name the server stated, if any.

length long?

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

cancellationToken CancellationToken

Returns

Task<byte[]>