Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!