Compress a file or a directory with files.
compress(format, source, target [, includeBaseFolder] [, mode])
returns boolean
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| format | string | Yes | The format in which you want to compress the files. | |
| source | string | Yes | Path (relative or absolute) to the file or directory you want to compress. | |
| target | string | Yes | Path (relative or absolute) including the name, where you want to save the compressed output-file. | |
| includeBaseFolder | boolean | No | true | Compress the directory or just the content of the directory. |
| mode | string | No | 777 |
Compress the file “example.txt” to a zip-file.
compress("zip", "example.txt", "output.zip")
Compress the “example-directory” to a zip-file.
compress("zip", "example-directory", "output.zip")