Back to Whatsapp Web Js

whatsapp

docs/MessageMedia.html

1.34.72.0 KB
Original Source

Properties

datafilename

filesizemimetype

Methods

fromFilePath(filePath)

fromUrl(url[, options])

new MessageMedia(mimetype, data, filename, filesize)

Parameters

NameTypeOptionalDescription

mimetype

|

|

|

MIME type of the attachment

| |

data

|

|

|

Base64-encoded data of the file

| |

filename

|

|

|

Document file name. Value can be null

Value can be null.

| |

filesize

|

|

|

Document file size in bytes. Value can be null

Value can be null.

|

Properties

data string

Base64 encoded data that represents the file

filename nullable string

Document file name. Value can be null

filesize nullable number

Document file size in bytes. Value can be null

mimetype string

MIME type of the attachment

Methods

static

fromFilePath(filePath) → MessageMedia

Creates a MessageMedia instance from a local file path

Parameter

NameTypeOptionalDescription

filePath

|

string

|

| |

Returns

MessageMedia

async static

fromUrl(url[, options]) → Promise containing MessageMedia

Creates a MessageMedia instance from a URL

Parameters

NameTypeOptionalDescription

url

|

string

|

| | |

options

|

Object

|

Yes

|

Values in options have the following properties:

NameTypeOptionalDescription

unsafeMime

|

boolean

|

Yes

|

Defaults to false.

| |

filename

|

string

|

Yes

| | |

client

|

object

|

Yes

| | |

reqOptions

|

object

|

Yes

| | |

reqOptions.size

|

number

|

Yes

|

Defaults to 0.

|

|

Returns

Promise containing MessageMedia