Functions/Convert-Base64EncodedBytesToFile.ps1

<#
.SYNOPSIS
    This function converts Base64 encoded bytes into file contents.
#>

function Convert-Base64EncodedBytesToFile {
    [CmdletBinding(PositionalBinding=$true)]
    [OutputType()]
    param (
        # The Base64 encoded byte content of the file.
        [Parameter(Mandatory=$true, ValueFromPipeline=$true)]
        [ValidateNotNullOrEmpty()]
        [String]$base64Content,

        # The file path.
        [Parameter(Mandatory=$true, Position=0)]
        [ValidateNotNullOrEmpty()]
        [String]$path
    )

    # Set the contents of the file
    [Convert]::FromBase64String($base64Content) | Set-Content -Path $path -NoNewline -Encoding Byte
}