云函数使用request-promise下载图片变小,图片无效是什么问题?
发布于 5 年前 作者 jie47 6937 次浏览 来自 官方Issues

在云函数调用request-promise访问图片地址获取到的文件比原文件小,

代码如下:

const rp = require('request-promise')

const res = await rp(event.download_url)
  
  let buf = new Buffer(res.length)
  buf.write(res)
  return await cloud.uploadFile({
    cloudPath: event.path,
    fileContent: buf
  })

比如说图片大小242.33 KB

通过上面得到的文件只有228.52 KB

请问是什么问题?有知道的可以指点一下吗?

摸索了一天没解决

1 回复

图片无效有报错信息吗?

回到顶部