Compress Resource
Synopsis
Creates ZIP archives from a source directory or file. Supports configurable compression levels and verifies whether the archive contents match the source.
Type
Capabilities
- Get
- Set
- Test
Properties
archivePath
Path to the ZIP archive file to create.
sourcePath
Path to the source directory or file.
compressionLevel
Compression level to use when creating the archive.
Accepted values are:
- Optimal
- Fastest
- NoCompression
_inDesiredState
Whether the archive contents match the source.
Examples
Example 1 — Create a ZIP archive
Example 2 — Create with fastest compression
Example 3 — Configuration document
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Archive application logs
type: OpenDsc.Archive.Zip/Compress
properties:
archivePath: /backups/app-logs.zip
sourcePath: /var/log/myapp
compressionLevel: Optimal
Exit codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error |
| 2 | Invalid JSON |
| 3 | Source path not found |
| 4 | Invalid argument |
| 5 | IO error |
| 6 | Invalid or corrupt archive |