- ๐ญ Iโm currently working on WireMock.Net
- ๐ฑ Iโm currently learning more Azure and Blazor
Environments
Languages
Frontends
Fast download from files to the browser from Blazor without any javascript library reference or dependency.
License: MIT License
Environments
Languages
Frontends
Hi can you please add example how to use it with core hosted type of wasm ? It is all depending how you gonna get bytes from server side. Dont see any point to generate some random bytes on client side, it is pretty useless right ?
Regards
Hi, can you please show me how to download excel or csv file from list of objects?
thanks a lot.
Just thought to get your feedback on this.
I am using the following code to create a byte[] from a (video) URL and then your component and it works just splendidly but do you see an issue with it or recommend that I use something else?
private async Task DownloadAsync(string path)
{
using var client = new HttpClient();
using var response = await client.GetAsync(path.Url);
byte[] imageBytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
await BlazorDownloadFileService.DownloadFileAsync("Video.mp4", imageBytes);
}
Would you do something else or is this just fine in WASM Blazor-land?
p.s
The video files can get pretty large.
e.s
Would be great to have a BlazorDownloadFileService.DownloadFileFromUrlAsync() method
Was curious if this should work when using Blazor Server? I saw mention of WebAssembly, but not Server in the README.
Also was wondering what advantages this library has over BlazorDownloadFile, or why you would choose one over the other?
Thanks!
As the title says. I've got a working Blazor WASM project using .Net 6 and VS 2022.
I download this nuget and then start the app and get the following exception on the console:
blazor.webassembly.js:1 System.AggregateException: One or more errors occurred. (Invalid JS call result type '3'.
Error: Invalid JS call result type '3'.
at S (https://localhost:7171/_framework/blazor.webassembly.js:1:5038)
at Object.invokeJSFromDotNet (https://localhost:7171/_framework/blazor.webassembly.js:1:3170)
at Object.At [as invokeJSFromDotNet] (https://localhost:7171/_framework/blazor.webassembly.js:1:58414)
at _mono_wasm_invoke_js_blazor (https://localhost:7171/_framework/dotnet.6.0.0.a1fp8dqnl9.js:1:193780)
at wasm://wasm/00945abe:wasm-function[2588]:0x8065b
at wasm://wasm/00945abe:wasm-function[2307]:0x689a7
at wasm://wasm/00945abe:wasm-function[7015]:0x17bac4
at wasm://wasm/00945abe:wasm-function[6830]:0x172bc5
at wasm://wasm/00945abe:wasm-function[3524]:0xb47cc
at wasm://wasm/00945abe:wasm-function[675]:0x16602)
---> Microsoft.JSInterop.JSException: Invalid JS call result type '3'.
Error: Invalid JS call result type '3'.
at S (https://localhost:7171/_framework/blazor.webassembly.js:1:5038)
at Object.invokeJSFromDotNet (https://localhost:7171/_framework/blazor.webassembly.js:1:3170)
at Object.At [as invokeJSFromDotNet] (https://localhost:7171/_framework/blazor.webassembly.js:1:58414)
at _mono_wasm_invoke_js_blazor (https://localhost:7171/_framework/dotnet.6.0.0.a1fp8dqnl9.js:1:193780)
at wasm://wasm/00945abe:wasm-function[2588]:0x8065b
at wasm://wasm/00945abe:wasm-function[2307]:0x689a7
at wasm://wasm/00945abe:wasm-function[7015]:0x17bac4
at wasm://wasm/00945abe:wasm-function[6830]:0x172bc5
at wasm://wasm/00945abe:wasm-function[3524]:0xb47cc
at wasm://wasm/00945abe:wasm-function[675]:0x16602
at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeJS(String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)
at Microsoft.JSInterop.JSInProcessRuntime.Invoke[IJSVoidResult](String identifier, Int64 targetInstanceId, Object[] args)
at Microsoft.JSInterop.JSInProcessRuntime.Invoke[IJSVoidResult](String identifier, Object[] args)
at Microsoft.JSInterop.JSInProcessRuntimeExtensions.InvokeVoid(IJSInProcessRuntime jsRuntime, String identifier, Object[] args)
at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.AttachRootComponentToBrowser(Int32 componentId, String domElementSelector)
at Microsoft.AspNetCore.Components.RenderTree.WebRenderer.AddRootComponent(Type componentType, String domElementSelector)
at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.AddComponentAsync(Type componentType, ParameterView parameters, String domElementSelector)
at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHost.<>c.<<RunAsyncCore>b__15_1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHost.RunAsyncCore(CancellationToken cancellationToken, WebAssemblyCultureProvider cultureProvider)
at Program.Main(String[] args) in Program.cs:line 41
--- End of inner exception stack trace ---
Program.cs:line 41
is builder.Build().RunAsync()
I've tried it with an empty project as well, there it did not cause this issue. Unfortunately, I cannot share the project where the problem happened, but I'm happy to answer any questions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.