UNPKG

@soleil-se/build-app

Version:

Script for building WebApps, RESTApps and Widgets with Svelte in Sitevision.

19 lines (16 loc) 475 B
import archiver from 'archiver'; import fse from 'fs-extra'; export default function zip({ src, dest }) { return () => { const archive = archiver('zip', { zlib: { level: 9 } }); const stream = fse.createWriteStream(dest); return new Promise((resolve, reject) => { archive .directory(src, false) .on('error', (err) => reject(err)) .pipe(stream); stream.on('close', () => resolve()); archive.finalize(); }); }; }