( key: string, context: StorageContext )
| 507 | * Throws on errors other than "not found". For local filesystem, returns null. |
| 508 | */ |
| 509 | export async function headObject( |
| 510 | key: string, |
| 511 | context: StorageContext |
| 512 | ): Promise<{ size: number; contentType?: string } | null> { |
| 513 | const config = getStorageConfig(context) |
| 514 | |
| 515 | if (USE_BLOB_STORAGE) { |
| 516 | const { headBlobObject } = await import('@/lib/uploads/providers/blob/client') |
| 517 | return headBlobObject(key, createBlobConfig(config)) |
| 518 | } |
| 519 | |
| 520 | if (USE_S3_STORAGE) { |
| 521 | const { headS3Object } = await import('@/lib/uploads/providers/s3/client') |
| 522 | return headS3Object(key, createS3Config(config)) |
| 523 | } |
| 524 | |
| 525 | return null |
| 526 | } |
| 527 | |
| 528 | /** |
| 529 | * Generate a presigned URL for direct file upload |
no test coverage detected