| external help file | PSCompression.dll-Help.xml |
|---|---|
| Module Name | PSCompression |
| online version | https://github.com/santisq/PSCompression |
| schema | 2.0.0 |
Decompresses Gzip-compressed Base64-encoded strings.
ConvertFrom-GzipString
[-InputObject] <String[]>
[-Encoding <Encoding>]
[-Raw]
[<CommonParameters>]The ConvertFrom-GzipString cmdlet decompresses Base64-encoded strings that were compressed using GZip compression (via the GZipStream class). It is the counterpart to ConvertTo-GzipString.
PS ..\pwsh> ConvertFrom-GzipString H4sIAAAAAAAACstIzcnJ5+Uqzy/KSeHlUuTlAgBLr/K2EQAAAA==
hello
world
!This example decompresses a GZip-compressed Base64 string, restoring the original multi-line text.
PS ..\pwsh> $strings = 'hello', 'world', '!'
PS ..\pwsh> $compressed = $strings | ConvertTo-GzipString
PS ..\pwsh> $decompressed = $compressed | ConvertFrom-GzipString -Raw
PS ..\pwsh> $decompressed.GetType() # System.String
PS ..\pwsh> $decompressed
hello
world
!This example compares the default behavior (outputting an array of strings split on newlines) with the -Raw switch (returning a single string with newlines preserved).
Specifies the text encoding to use for the decompressed output string(s).
Note
The default encoding is UTF-8 without BOM.
Type: Encoding
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: utf8NoBOM
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the GZip-compressed Base64 string(s) to decompress.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseBy default, the cmdlet splits the decompressed text on newline characters and outputs an array of strings. The -Raw switch returns the entire decompressed text as a single string (with newlines preserved).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters. For more information, see about_CommonParameters.
You can pipe GZip-compressed Base64 strings to this cmdlet.
By default: System.String[] (one element per line). With -Raw: System.String (single multi-line string).