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

167
Vistas
Unable to open any file from browser

i'm using file-saver package to download files. The downloading is not the issue it seems to be the opening of any file. I console.log file from the files function logic below and get this:

File {name: '5ece9322f34d050a92546892.jpeg', lastModified: 1641918175691, lastModifiedDate: Tue Jan 11 2022 16:22:55 GMT+0000 (Greenwich Mean Time), webkitRelativePath: '', size: 156, …}
    lastModified: 1641918175691
    lastModifiedDate: Tue Jan 11 2022 16:22:55 GMT+0000 (Greenwich Mean Time)
    [[Prototype]]: Object
    name: "5ece9322f34d050a92546892.jpeg"
    size: 156
    type: ".jpeg"
    webkitRelativePath: ""
    [[Prototype]]: File

I get the following error:

The file 5ece9322f34d050a92546892.jpeg could not be opened.It may be damaged or use a file format that Preview doesn’t recognise.

My code:

import { saveAs } from 'file-saver';

  const files = ({url, fileName}) => {
    const extension = url.slice(url.lastIndexOf('.'));
      const handleDownloadDocument = (fileUrl, name, ex) => {
        const file = new File([fileUrl], name, { type: ex });
        return saveAs(file);
      };

   return(<div onClick={() => handleDownloadDocument(url, fileName, extension)}> download </div>);

};
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