// Editor.Compression.Zip wraps a directory tree into a single .zip and // (un)packs it back. Below: stage a couple of assets in a temp dir, // zip the whole directory, then unpack into a sibling location. constfs = awaitimport('LensStudio:FileSystem');
// Pack the directory into a single archive constarchive = tmp.path.appended(newEditor.Path('assets.zip')); Editor.Compression.Zip.pack(sourceDir, archive); console.log('packed:', archive, 'size:', fs.size(archive));
// Unpack into a sibling directory constout = tmp.path.appended(newEditor.Path('extracted')); fs.createDir(out, nullasany); Editor.Compression.Zip.unpack(archive, out); console.log('unpacked entries:', fs.readDir(out, nullasany).length);
Module to zip and unzip files.
Example