Types/OpenPackage.Source/AtBlob.ps1

<#
.SYNOPSIS
    Gets at blobs
.DESCRIPTION
    Gets blobs from the at protocol.
#>

param(
# The decentralized identifier (did)
[Parameter(Mandatory)]
[string]
$did,

# The content identifier (cid)
[Parameter(Mandatory)]
[string]
$cid,

# The personal data server (pds)
[string]
$pds = "https://bsky.social/",

# Any additional headers to pass into a web request.
[Alias('Header')]
[Collections.IDictionary]
$Headers
)

$invokeSplat = @{
    uri = "$(# Be fault tolerant with the pds format
    if ($pds -like 'https://*') {
        # just trim trailing slashes from https urls
        $pds -replace '/$'
    } else {
        # and prefix anything else by https://
        "https://$pds" -replace '/$'
})/xrpc/com.atproto.sync.getBlob?did=$did&cid=$cid"

}
if ($headers) {
    $invokeSplat.Headers = $Headers
}

return Invoke-WebRequest @invokeSplat