How can one generate and save a file client side using Blazor?

Creator of Blazor Steve Sanderson used JavaScript interop for similar task during one of his last presentations. You can find example on BlazorExcelSpreadsheet Solution includes three parts: 1) JavaScript function saveAsFile(filename, bytesBase64) { var link = document.createElement(‘a’); link.download = filename; link.href = “https://stackoverflow.com/questions/52683706/data:application/octet-stream;base64,” + bytesBase64; document.body.appendChild(link); // Needed for Firefox link.click(); document.body.removeChild(link); } 2) C# … Read more

How can I return a JavaScript string from a WebAssembly function

WebAssembly doesn’t natively support a string type, it rather supports i32 / i64 / f32 / f64 value types as well as i8 / i16 for storage. You can interact with a WebAssembly instance using: exports, where from JavaScript you call into WebAssembly, and WebAssembly returns a single value type. imports where WebAssembly calls into … Read more