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

130
Vistas
Read response outputstream in javascript

I have a response in this given format in java:

if (Files.exists(filePath)) {
        response.setContentType(Files.probeContentType(filePath));
        response.addHeader("Content-Disposition", "attachment; filename=" + file.getName());
        Files.copy(filePath, response.getOutputStream());
        response.getOutputStream().flush();
      } 

How do I read the file and download in javascript react?

const url = window.URL.createObjectURL(new Blob([response.data]));
    const link = document.createElement('a');
    link.href = url;
    link.setAttribute('download', response.filename);
    document.body.appendChild(link);
    link.click();

But its not working,How can I fix it and read file name and data and download it on get request?

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