Function: isBlobRef()
isBlobRef(
value):value is BlobRef
Defined in: src/types/atproto-validators.ts:215
Type guard for BlobRef objects.
Parameters
value
unknown
Value to check
Returns
value is BlobRef
True if value is a valid BlobRef
Remarks
Validates that an unknown value conforms to the BlobRef interface:
- Has
$typeproperty equal to'blob' - Has
refproperty (CID) - Has
mimeTypeproperty (string) - Has
sizeproperty (number)
This guard performs structural validation but does not validate the CID format or MIME type validity.
Example
const blob = {
$type: 'blob' as const,
ref: 'bafyreib...' as CID,
mimeType: 'application/pdf',
size: 2048576
};
if (isBlobRef(blob)) {
console.log('Valid BlobRef:', blob.ref);
}