Skip to content

IOFileFormat.LoadAsync Method

Overloads

Name Description
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.

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

Parameters

Name Type Description
path String The path to the file to load.
supportedFormats IReadOnlyList<IOFileFormat> The supported formats for the file.
cancellationToken CancellationToken An 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.

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

View source

Parameters

Name Type Description
path String The path of the file in the stream. Used to determine the type of the file.
stream Stream The file.
supportedFormats IReadOnlyList<IOFileFormat> The supported formats for the file.
cancellationToken CancellationToken An optional CancellationToken to cancel the loading.

Returns

Task<IOFile>

The file that was read.