yakyak / hangupsjs

google hangouts client library for nodejs
226 stars 46 forks source link

Add support for imagefile as Buffer when uploading #99

Closed quazzie closed 4 years ago

quazzie commented 5 years ago

Pass buffer as imagefile to upload buffer instead of reading from a file.

averissimo commented 5 years ago

How can I test this?

quazzie commented 5 years ago
async function test() {
  const bld = new Client.MessageBuilder()
  segments = bld.text('Hello ').bold('World').text('!').toSegments()
  const image = fs.readFileSync('c:\image.png');
  const image_id = await client.uploadimage(image, 'testimage.png');
  client.sendchatmessage('UgzfaJwj2Tg_oqk5EhEp5faABAQ', segments, image_id);
}