Table of Contents

Method CreateFromFileAsync

Namespace
LMKit.Data
Assembly
LM-Kit.NET.dll

CreateFromFileAsync(string, CancellationToken)

Creates a new Attachment instance asynchronously by loading content from the specified file path.

public static Task<Attachment> CreateFromFileAsync(string path, CancellationToken cancellationToken = default)

Parameters

path string

The file system path to the attachment file.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<Attachment>

A task that represents the asynchronous operation. The task result contains the loaded Attachment.

Exceptions

FileNotFoundException

Thrown when the specified file does not exist.

UnsupportedFileTypeException

Thrown when the file format is not supported.

OperationCanceledException

Thrown when the operation is canceled.

See Also