# Compress

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

You can load the module using the following code:

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:

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

or multiple files:

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
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:

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