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

156
Vistas
Optimising large string on browser on load time

I have created a function which will dynamically append xml content to a string variable on browser on load time . However, when the string becomes enormous , it will result in memory loss. I have created a function which enable user to download as xls format.

For an example,

//This has 1k records which are translated as xml content that is stored in uri variable on browser. We are able to download xls file with no issue

//String length e.g 20k
var workbookXML = 'data:application/vnd.ms-excel;base64,.......<?xml version="1.0"?><?mso-.application progid="Excel.Sheet"?>.........'

now when im appending high volume of data that are translated into xml content , this will result the browser to stop and prompt Memory loss issue on browser

//String length e.g 20million
var workbookXML = 'data:application/vnd.ms-excel;base64,.......<?xml version="1.0"?><?mso-.application progid="Excel.Sheet"?>.........'

I have look into writableStream but this will result the same as this will be on browser. . What are best approaches in this use cases to resolve big data into a single string variable on browser?

Should i convert string into binary, bytes before exporting as xls format ?

        var excel_blob = new Blob([workbookXML], { type: 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
        var link = document.createElement("A");
        link.href = window.webkitURL.createObjectURL(excel_blob)
        link.download = "BigData" + ".xls";
        link.target = '_blank';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What are best approaches in this use cases to resolve big data into a single string variable on browser?

Simple: don't.

It looks like you're trying to download files? There already is a tried and true protocol to download files, which is using a get request to get back a file (or multiple files, if your browser supports it).

There's absolutely no need to store the entire file in html in a base64 string, append it to your DOM as an element, click it to initiate the download and remove it. That's just insanity.

about 4 years ago · Juan Pablo Isaza Denunciar
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