Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.71 KB

File metadata and controls

34 lines (23 loc) · 1.71 KB

Download

Save data as a file download on the filesystem. For file upload use the InputFile component.



Example

public sealed partial class ExampleComponent : ComponentBase {
    [Inject]
    public required IDownload Download { private get; init; }

    private async Task Example() {
        await Download.DownloadAsFile("example.txt", "example content");
    }
}



Members

IDownload

Methods

Name Parameters ReturnType Description
DownloadAsFile string fileName, string fileContent, [CancellationToken cancellationToken = default] ValueTask Triggers a download by adding an <a>-element to the document and simulate a click on it.
DownloadAsFile string fileName, byte[] fileContent, [CancellationToken cancellationToken = default] ValueTask Triggers a download by adding an <a>-element to the document and simulate a click on it.
DownloadAsFile string fileName, DotNetStreamReference fileContent, [CancellationToken cancellationToken = default] ValueTask Triggers a download by adding an <a>-element to the document and simulate a click on it.

Note: IDownloadInProcess does not exist, because method DownloadAsFile is itself an asynchronous operation.