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

157
Views
Can I copy a folder with Archive JavaScript?

I want to use archiver (https://www.npmjs.com/package/archiver) To copy a whole folder into the zip file. here is my code.

I Don't know how to do this, I have tried researching but found nothing yet.

const fs = require('fs');
const archiver = require('archiver');

const output = fs.createWriteStream(__dirname + '/example.zip');
const archive = archiver('zip', {
  zlib: { level: 9 } // Sets the compression level.
});

archive.on('error', function(err) {
    throw err;
  });
  
  archive.pipe(output);

archive.file(`C:\\Users\\John\\Desktop\\MyFolder`, {name: 'MyFolder'});
  archive.finalize();
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!