【发布时间】:2022-08-18 19:36:56
【问题描述】:
我根据documentation从谷歌驱动器下载我的PDF文件:
const file = await this.driveClient.files.get(
{
fileId: id,
alt: \'media\',
},
{
responseType: \'stream\'
},
);
然后我构造一个表单数据:
const formData = new FormData();
formData.append(\'file\', file.data, \'file.pdf\');
并通过presigned upload url 将其发送到 S3:
const uploadedDocument = await axios({
method: \'put\',
url: presignedS3Url,
data: formData,
headers: formData.getHeaders(),
});
我还尝试了来自 Google API 的不同响应类型,例如 blob。知道我缺少什么吗?提前致谢!
标签: javascript node.js amazon-s3 google-drive-api