问题描述
当尝试使用javascript和此处引用的google文件api下载文件时:
https://developers.google.com/drive/api/v3/reference/files
响应正文已编码为文本。问题是下载二进制文件(.sav),然后编码不正确。我正在使用的代码很简单:
gapi.client.drive.files.get({ 'fileId': self.selectedFileId,alt: 'media' }).then((response) => {
// response.body is text
}
根据Reading a binary file from Google Drive using node.js,您可以将编码设置为null,但在当前(v3)REST api的任何地方都看不到。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)