CreateAttachment
Defined in: packages/builders/src/attachment.ts:18
Builder for message attachments and file uploads.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CreateAttachment(
file,data?):CreateAttachment
Defined in: packages/builders/src/attachment.ts:25
Parameters
Section titled “Parameters”string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>
string | Partial<Omit<AttachmentData, "file">>
Returns
Section titled “Returns”CreateAttachment
Properties
Section titled “Properties”description?
Section titled “description?”
optionaldescription?: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
optionalroot?:string
Defined in: packages/builders/src/attachment.ts:23
Folder a string file must stay inside; see AttachmentData.root.
Methods
Section titled “Methods”setDescription()
Section titled “setDescription()”setDescription(
description):this
Defined in: packages/builders/src/attachment.ts:48
Sets the attachment description / alt text.
Parameters
Section titled “Parameters”description
Section titled “description”string
Returns
Section titled “Returns”this
setFile()
Section titled “setFile()”setFile(
file):this
Defined in: packages/builders/src/attachment.ts:54
Sets the file contents.
Parameters
Section titled “Parameters”string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>
Returns
Section titled “Returns”this
setName()
Section titled “setName()”setName(
name):this
Defined in: packages/builders/src/attachment.ts:42
Sets the attachment filename.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
toBuffer()
Section titled “toBuffer()”toBuffer():
Promise<Uint8Array<ArrayBufferLike>>
Defined in: packages/builders/src/attachment.ts:62
Resolves the attachment payload to a binary Uint8Array.
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>