wechaty / puppet-xp

Wechaty Puppet WeChat Windows Protocol
http://wechaty.js.org/docs/puppet-providers/xp
Apache License 2.0
472 stars 114 forks source link

收到附件后,执行 msg.toFileBox,文件里无论是buffer 还是 stream 都是undefined #196

Open danni-cool opened 12 months ago

danni-cool commented 12 months ago

业务代码

  switch (msg.type()) {
    case 1: // 附件
    case 2: // 语音
    case 6: // 图片
    case 15: {
      // 视频
      const steamFile = await msg.toFileBox()
      const type = await fileTypeFromBuffer(
        steamFile.buffer || steamFile.stream,
      )

实际 steamFile 内容

{
  version: "1.4.15",
  _type: 5,
  _size: 21386,
  mimeType: "application/unknown",
  _mediaType: "text/csv",
  _name: "123.csv",
  _metadata: undefined,
  base64: undefined,
  remoteUrl: undefined,
  qrCode: undefined,
  uuid: undefined,
  buffer: undefined,
  localPath: "C:\\Document\\WeChat Files\\wxid_wwqi157cAlfj42\\FileStorage\\File\\2023-12\\123.csv",
  stream: undefined,
  headers: undefined,
}