Secreto31126 / whatsapp-api-js

A TypeScript server agnostic Whatsapp's Official API framework
MIT License
128 stars 31 forks source link

Create a Media ID from file object #316

Closed angelopedroso closed 4 months ago

angelopedroso commented 4 months ago

How I could create a media ID from a File Object?

file: {
  fieldname: 'example',
  originalname: 'example.png',
  encoding: '7bit',
  mimetype: 'image/png',
  buffer: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 90 00 00 00 b2 08 06 00 00 00 6c ac 99 45 00 00 00 09 70 48 59 73 00 00 0b 13 00 00 0b 13 01 ... 60191 more bytes>,
  size: 60241
}
angelopedroso commented 4 months ago

I convert the file object to Blob, and fix it

Secreto31126 commented 4 months ago

Yeah, unfortunately the API doesn't support the File type, so Blob is the only solution