Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

344
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda