kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch17/base64.ps1

15 lines
310 B
PowerShell
Raw Normal View History

function Convert-ToBase64 {
param (
[parameter(ValueFromPipeline)]
[string] $text,
[switch] $d
)
if ($d){
[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($text))
}
else {
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($text))
}
}
Set-Alias base64 Convert-ToBase64