问题描述
我想使用Google Drive API下载大于10MB的 .doc 文件.我知道使用Google Drive API时导出和下载之间的区别.我可以下载具有二进制内容(无限制)的文件.我应该使用导出来下载 .doc 文件,但是有限制(10MB).我的文件大于10MB.我可以使用下载方式下载.doc文件吗?
从根本上讲,它可以通过调用文件来获取文件的exportLinks属性.:使用?fields = exportLinks
获取.这将为您提供每种可能的导出mimetype的一堆exportLinks.没有文件大小限制.
其基本URL通常是相同的,因此我将它们保存为常量.
#实现示例开关($ fileMetadata.mimetype){'application/vnd.google-apps.spreadsheet'{$ exportBaseUrl ="https://docs.google.com/spreadsheets/export?id="$ exportBaseUrlExtension =& exportFormat = xlsx"}}$ uri ="$ exportBaseUrl $ itemId $ exportBaseUrlExtension"#现在您可以拨打
有关详细信息,请参见文件:概述参考>
I want to download bigger than 10MB .doc files using Google Drive API.I know difference between export and download when using Google Drive API. I can download files which has binary content(no limit). I should use export for downloading .doc files but there is a limit (10MB). My files larger than 10MB. Is there any way i can download .doc files using download?
This is answered in this question
It basically comes down to fetching the file's exportLinks property from calling Files: get with ?fields=exportLinks
.This will give you a bunch of exportLinks for each possibly export mimetype. This has no file size limit.
The base URL for that is usually the same so I've just saved them as constants.
# Example of implementation
switch ($fileMetadata.mimetype) {
'application/vnd.google-apps.spreadsheet' {
$exportBaseUrl = "https://docs.google.com/spreadsheets/export?id="
$exportBaseUrlExtension = "&exportFormat=xlsx"
}
}
$uri = "$exportBaseUrl$itemId$exportBaseUrlExtension"
# Now you can make a call to
See the Files: overview reference for more information
这篇关于是否可以使用Google Drive API下载大于10MB的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!