Preview environment

class Attachment

export class Attachment

Represents an attachment

contentType : string | null

The media (MIME) type of this attachment

See also: https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

description : string | null

The description (alt text) of this attachment

duration : number | null

The duration of this attachment in seconds This will only be available if the attachment is an audio file.

ephemeral : boolean

Whether this attachment is ephemeral

The flags of this attachment

height : number | null

The height of this attachment (if an image or video)

id : Snowflake

The attachment's id

name : string

The name of this attachment

proxyURL : string

The Proxy URL to this attachment

size : number

The size of this attachment in bytes

readonly
spoiler : boolean

Whether or not this attachment has been marked as a spoiler

title : string | null

The title of this attachment This will only be available if the attachment name contains special characters.

url : string

The URL to this attachment

waveform : string | null

The base64 encoded byte array representing a sampled waveform This will only be available if the attachment is an audio file.

width : number | null

The width of this attachment (if an image or video)

toJSON() : unknown