// 2. Send media file inside Room
import { FileBox }  from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromLocal('/tmp/text.txt')
await room.say(fileBox1)
await room.say(fileBox2)

以上代码使用会报错

TypeError: FileBox.fromUrl is not a function

 

以下才是正确用法

const { FileBox }  = require('file-box')
 
const fileBox1 = FileBox.fromUrl(
  'http://pic1.win4000.com/pic/6/3b/c6551219684.jpg',
  'logo.jpg',
)
fileBox1.toFile('logo.jpg')

 

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2021-05-02
  • 2022-01-08
  • 2021-11-24
  • 2021-09-10
  • 2022-02-02
  • 2021-07-27
相关资源
相似解决方案