You've already forked SharedScripts
mirror of
https://github.com/jaapbrasser/SharedScripts.git
synced 2025-12-24 21:51:38 +02:00
20 lines
583 B
PowerShell
20 lines
583 B
PowerShell
Function ConvertTo-CompressedBase64 {
|
|
<#
|
|
.SYNOPSIS
|
|
Function to convert a string to a Compressed base64 string
|
|
#>
|
|
[cmdletbinding()]
|
|
param(
|
|
[Parameter(
|
|
ValueFromPipeline=$true
|
|
)]
|
|
[string] $InputObject
|
|
)
|
|
$ms = New-Object System.IO.MemoryStream
|
|
$cs = New-Object System.IO.Compression.GZipStream($ms, [System.IO.Compression.CompressionMode]::Compress)
|
|
$sw = New-Object System.IO.StreamWriter($cs)
|
|
$sw.Write($InputObject.ToCharArray())
|
|
$sw.Close()
|
|
[System.Convert]::ToBase64String($ms.ToArray())
|
|
}
|