Class: MessageMedia

MessageMedia(mimetype, data, filenamenullable, filesizenullable)

Media attached to a message

Constructor

new MessageMedia(mimetype, data, filenamenullable, filesizenullable)

Parameters:
Name Type Attributes Description
mimetype string

MIME type of the attachment

data string

Base64-encoded data of the file

filename string <nullable>

Document file name. Value can be null

filesize number <nullable>

Document file size in bytes. Value can be null

Source:

Members

data :string

Base64 encoded data that represents the file

Type:
  • string
Source:

(nullable) filename :string

Document file name. Value can be null

Type:
  • string
Source:

(nullable) filesize :number

Document file size in bytes. Value can be null

Type:
  • number
Source:

mimetype :string

MIME type of the attachment

Type:
  • string
Source:

Methods

(static) fromFilePath(filePath) → {MessageMedia}

Creates a MessageMedia instance from a local file path

Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
MessageMedia

(async, static) fromUrl(url, optionsopt) → {Promise.<MessageMedia>}

Creates a MessageMedia instance from a URL

Parameters:
Name Type Attributes Description
url string
options Object <optional>
Properties
Name Type Attributes Default Description
unsafeMime boolean <optional>
false
filename string <optional>
client object <optional>
reqOptions object <optional>
Properties
Name Type Attributes Default Description
size number <optional>
0
Source:
Returns:
Type
Promise.<MessageMedia>