The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/server/lib/dataExport/makeZipFile.ts

19 lines
489 B

import { createWriteStream } from 'fs';
import archiver from 'archiver';
export const makeZipFile = (folderToZip: string, targetFile: string): Promise<void> => {
return new Promise(async (resolve, reject) => {
const output = createWriteStream(targetFile);
const archive = archiver('zip');
output.on('close', () => resolve());
archive.on('error', (error) => reject(error));
archive.pipe(output);
archive.directory(folderToZip, false);
await archive.finalize();
});
};