function Test-Utf8BomHeader { | |
[CmdletBinding(DefaultParameterSetName = "File")] | |
[OutputType([bool])] | |
param( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "File")] | |
[System.IO.FileInfo]$File, | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "Path")] | |
[Alias("LiteralPath", "PSPath")] | |
[string]$Path | |
) | |
process { | |
if ($PSBoundParameters.ContainsKey("File")) { | |
$header = [FileHeader]::Read($File, $removeOffset) | |
Write-Output ($header -eq $bomHex) | |
} | |
else { | |
$header = [FileHeader]::Read($Path, $removeOffset) | |
Write-Output ($header -eq $bomHex) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment