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

355
Visualizações
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 à 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