Class: Attachment
Represents an attachment to be uploaded and the associated metadata.
Attachment
objects can be inserted anywhere in an event, allowing you to
log arbitrary file data. The SDK will asynchronously upload the file to
object storage and replace the Attachment
object with an
AttachmentReference
.
Constructors
constructor
• new Attachment(«destructured»
): Attachment
Construct an attachment.
Parameters
Name | Type |
---|---|
«destructured» | AttachmentParams |
Returns
Methods
debugInfo
▸ debugInfo(): Record
<string
, unknown
>
A human-readable description for logging and debugging.
Returns
Record
<string
, unknown
>
The debug object. The return type is not stable and may change in a future release.
upload
▸ upload(): Promise
<{ error_message?
: string
; upload_status
: "error"
| "done"
| "uploading"
}>
On first access, (1) reads the attachment from disk if needed, (2) authenticates with the data plane to request a signed URL, (3) uploads to object store, and (4) updates the attachment.
Returns
Promise
<{ error_message?
: string
; upload_status
: "error"
| "done"
| "uploading"
}>
The attachment status.
Properties
reference
• Readonly
reference: Object
The object that replaces this Attachment
at upload time.
Type declaration
Name | Type |
---|---|
content_type | string |
filename | string |
key | string |
type | "braintrust_attachment" |