TypeError: FileBox.fromUrl is not a function

// 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')
原文地址:https://www.cnblogs.com/panjinzhao/p/12592219.html