Skip to content
On this page

Compress

This documents the Compress module and how to use it from JavaScript flows.

You can load the module using the following code:

js
var c = Module.load("Compress", {version: "X.Y.Z"});

Compress files

Using the loaded module c from above, you can compress a single file using the following code:

js
c.compress("input.txt", "C://temp/output.zip");

or multiple files:

js
c.compress(["input.txt", "input2.txt"], "C://temp/output.zip");

An optional third options parameter can be used provide the format of the output file. The default is zip. The following formats are supported:

  • zip
  • tar
  • tar.gz
js
c.compress("input.txt", "C://temp/output.tar.gz", { format: "tar.gz" });

Decompress files

Using the loaded module c from above, you can decompress an archive using the following code:

js
c.decompress("C://temp/output.zip", "C://temp/decompressed");