Public/base64.ps1
function base64 { [CmdletBinding()] param( [parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] [string] $value, [switch] $decode ) if ($decode.IsPresent) { Write-output $([Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($value))) } else { Write-output $([System.Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($value))) } } |