Skip to content

IOFileFormat.LoadAsync Method ​

Overloads ​

NameDescription
LoadAsync(String, IReadOnlyList<IOFileFormat>, CancellationToken)Loads a file from disk asynchronously.
LoadAsync(String, Stream, IReadOnlyList<IOFileFormat>, CancellationToken)Loads a file from a stream asynchronously. Use as an alternative to LoadAsync(String, IReadOnlyList<IOFileFormat>, CancellationToken) when the file is not on disk, for example web upload.

LoadAsync(String, IReadOnlyList<IOFileFormat>, CancellationToken) ​

Loads a file from disk asynchronously.

c#
public static Task<IOFile> LoadAsync(string path, IReadOnlyList<IOFileFormat> supportedFormats, CancellationToken cancellationToken = null);

Parameters ​

NameTypeDescription
pathStringThe path to the file to load.
supportedFormatsIReadOnlyList<IOFileFormat>The supported formats for the file.
cancellationTokenCancellationTokenAn optional CancellationToken to cancel the loading.

Returns ​

Task<IOFile>

The file that was read.

LoadAsync(String, Stream, IReadOnlyList<IOFileFormat>, CancellationToken) ​

Loads a file from a stream asynchronously. Use as an alternative to LoadAsync(String, IReadOnlyList<IOFileFormat>, CancellationToken) when the file is not on disk, for example web upload.

c#
public static Task<IOFile> LoadAsync(string path, Stream stream, IReadOnlyList<IOFileFormat> supportedFormats, CancellationToken cancellationToken = null);

View source

Parameters ​

NameTypeDescription
pathStringThe path of the file in the stream. Used to determine the type of the file.
streamStreamThe file.
supportedFormatsIReadOnlyList<IOFileFormat>The supported formats for the file.
cancellationTokenCancellationTokenAn optional CancellationToken to cancel the loading.

Returns ​

Task<IOFile>

The file that was read.