Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

351
Views
Change the size limits while doing export of byte array as CSV from Blazor Server

I am using following code to convert a byte[] to CSV file

@inject IJSRuntime JsRuntime

var fileBytes =  //Helper method return the byte array back 
var fileName = string.Format("FileExport_UUID_{0}.csv", DateTime.Now.ToString("u"));
await JsRuntime.InvokeAsync<object>("saveAsFile", fileName, Convert.ToBase64String(fileBytes));

 
 The Javascript is like below 


/**
 * Export to excel helper method  
 * Inspired from project :  blazorhero/CleanArchitecture  wwwroot/js/file.js  File
 * File path : https://github.com/blazorhero/CleanArchitecture/blob/637517163f1e7f40b6be0952f8cf4ab690d759e0/src/Client/wwwroot/js/file.js
 * @param {any} options
 */
window.saveAsFile = function (fileName, byteBase64) {
    console.log("saveasFileCalled***");
    var link = this.document.createElement('a');
    link.download = fileName;
    //link.href = "data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64," + byteBase64;    
    //link.href = "data:application/octet-stream;base64," + byteBase64;
    link.href = "data:text/csv;base64," + byteBase64;
    this.document.body.appendChild(link);
    link.click();
    this.document.body.removeChild(link);
    console.log("End OF saveasFileCalled***");
}

The code is working fine for smaller byte arrays , however when the size of records is growing the export is not happening . Managed to download around 100 000 records, but when try to export a csv with 200 000 records, nothing is happening. On some machines export will work but on some other machines connected to slow network etc nothing is happening (After checking the file size from the machines where this export is completed I can see that size is around 90 MB )

While checking the Console I can see console.log("saveasFileCalled***"); & console.log("End OF saveasFileCalled***");

I am using .net 6 blazor Server side project Is any work arounds to reset the file size or any better way to do the job in .net 6

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!