Zippy is a quick compression module.
Compress-Zippycompresses contentExpand-Zippyexpands contents
Zippy currently supports four compression algorithms:
You can install Zippy from the PowerShell gallery
Install-Module Zippy -Scope CurrentUser -ForceOnce installed, you can import the module with:
Import-Module Zippy -PassThruYou can also clone the repo and import the module locally:
git clone https://github.com/PoshWeb/Zippy
cd ./Zippy
Import-Module ./ -PassThruZippy has 2 functions
Compresses Content using a number of standard algorithms.
- Brotli (default)
- Default
- Gzip
- Zlib
| Name | Type | Description |
|---|---|---|
| Text | String | The text to compress |
| Bytes | Byte[] | A range of bytes to compress. |
| Stream | Stream | A stream to compress. |
| Algorithm | String | The compression algorithm. By default, Brotli. |
| Encoding | Encoding | The text encoding. By default, this will be the $outputEncoding |
| CompressionLevel | CompressionLevel | The compression level. By default, this will be fastest. |
| AsByteStream | SwitchParameter | If set, will output a byte stream. If not set, will output a base64 encoded string. |
Compress-Zippy "Hello World"Compress-Zippy "Hello World" -Algorithm DeflateCompress-Zippy "Hello World" -Algorithm GZipCompress-Zippy "Hello World" -Algorithm ZlibCompress-Zippy "Hello World" -Algorithm Brotli -AsByteStreamCompress-Zippy "Hello World" -Algorithm Deflate -AsByteStreamCompress-Zippy "Hello World" -Algorithm GZip -AsByteStreamCompress-Zippy "Hello World" -Algorithm Zlib -AsByteStreamExpands Compressed Data using the .NET GZipStream class
| Name | Type | Description |
|---|---|---|
| CompressedData | String | The compressed data, as a Base64 string |
| BinaryData | Byte[] | The compressed data, as a byte array |
| AsByteStream | SwitchParameter | If set, will output a byte[] of decompressed bytes. |
| AsBase64 | SwitchParameter | If set, will output the decompressed data as a base64 string |
| Algorithm | String | The compression algorithm. By default, Brotli. |
| Encoding | Encoding | The text encoding. By default, this will be the $outputEncoding |
Compress-Zippy -String ("abc" * 1kb) |
Expand-ZippyCompress-Zippy "Hello World" | Expand-ZippyCompress-Zippy "Hello World" -Algorithm Deflate |
Expand-Zippy -Algorithm DeflateCompress-Zippy "Hello World" -Algorithm GZip |
Expand-Zippy -Algorithm GZipCompress-Zippy "Hello World" -Algorithm Zlib |
Expand-Zippy -Algorithm ZlibCompress-Zippy "Hello World" -Algorithm Brotli -AsByteStream |
Expand-ZippyCompress-Zippy "Hello World" -Algorithm Deflate -AsByteStream |
Expand-Zippy -Algorithm DeflateCompress-Zippy "Hello World" -Algorithm GZip -AsByteStream |
Expand-Zippy -Algorithm GZipCompress-Zippy "Hello World" -Algorithm Zlib -AsByteStream |
Expand-Zippy -Algorithm Zlib