Class: ReadonlyAttachment
A readonly alternative to Attachment, which can be used for fetching
already-uploaded Attachments.
Constructors
constructor
• new ReadonlyAttachment(reference, state?): ReadonlyAttachment
Construct a ReadonlyAttachment.
Parameters
| Name | Type | Description |
|---|---|---|
reference | Object | The AttachmentReference that should be read by the ReadonlyAttachment object. |
reference.content_type | string | - |
reference.filename | string | - |
reference.key | string | - |
reference.type | "braintrust_attachment" | - |
state? | BraintrustState | (Optional) For internal use. |
Returns
The new ReadonlyAttachment object.
Methods
data
▸ data(): Promise<Blob>
The attachment contents. This is a lazy value that will read the attachment contents from the object store on first access.
Returns
Promise<Blob>
status
▸ status(): Promise<{ error_message?: string ; upload_status: "error" | "done" | "uploading" }>
Fetch the attachment upload status. This will re-fetch the status each time in case it changes over time.
Returns
Promise<{ error_message?: string ; upload_status: "error" | "done" | "uploading" }>
Properties
reference
• Readonly reference: Object
Attachment metadata.
Type declaration
| Name | Type |
|---|---|
content_type | string |
filename | string |
key | string |
type | "braintrust_attachment" |