Skip to content

CreateAttachment

Defined in: packages/builders/src/attachment.ts:18

Builder for message attachments and file uploads.

new CreateAttachment(file, data?): CreateAttachment

Defined in: packages/builders/src/attachment.ts:25

string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>

string | Partial<Omit<AttachmentData, "file">>

CreateAttachment

optional description?: string

Defined in: packages/builders/src/attachment.ts:20


file: string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>

Defined in: packages/builders/src/attachment.ts:21


name: string

Defined in: packages/builders/src/attachment.ts:19


optional root?: string

Defined in: packages/builders/src/attachment.ts:23

Folder a string file must stay inside; see AttachmentData.root.

setDescription(description): this

Defined in: packages/builders/src/attachment.ts:48

Sets the attachment description / alt text.

string

this


setFile(file): this

Defined in: packages/builders/src/attachment.ts:54

Sets the file contents.

string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>

this


setName(name): this

Defined in: packages/builders/src/attachment.ts:42

Sets the attachment filename.

string

this


toBuffer(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: packages/builders/src/attachment.ts:62

Resolves the attachment payload to a binary Uint8Array.

Promise<Uint8Array<ArrayBufferLike>>