Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda