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

354
Vistas
Zip file as a buffer in javascript

I have own SharePoint integration in JavaScript.

For sending files I use endpoint: ${SITE}/_api/web/GetFolderByServerRelativeUrl('catalog')/Files/add(url='${fileName}',overwrite=true)

Everything works properly when I uploaded .jpg and .txt files. But when I try to upload .zip file, the file in SharePoint is not readable (I had Error 79 - Inappropriate file type or format).

Locally (generated by archiver library) this file is correct.

I sending files to SharePoint as a buffer generated by:

const buffer = fs.readFileSync(exportedAppDataArchive.pathToFile);

I also tried

const buffer = fs.readFileSync(exportedAppDataArchive.pathToFile).buffer;

and my function to send it to the SharePoint looks like:

await axiosInstance.post(fileCollectionEndpoint, arrayBuffer, {
    // responseType: 'buffer',
    headers: {
      // 'Content-Type': 'application/zip',
      // 'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)',
      Cookie: cookie,
      Authorization: `Bearer ${digest}`,
    },
  });

In comments it's my tries with different options...

What is the properly way to send a .zip file as a buffer?

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