Google Drive Rest API V3 Downloading large files with alt=media option (>25MB)

断了今生、忘了曾经 提交于 2019-12-11 06:28:12

问题


I am trying to figure out how I can download a large file directly in the browser via the Google Drive API V3.

I'm using option 1 which is : Download a file — files.get with alt=media file resource

When I send my request ( https://www.googleapis.com/drive/v3/files/[fileId]?alt=media), I got the content of the file as a response of it.

Currently I'm creating a blob file with the response of my query, then reading the blob file to start the download on the browser.

The problem with that is, reading the blob file consumes a lot of memory and if the file's size is more than 10MB, then browser crashes.

So my question is : how can I start the download on browsers via the Google APIs like mention on the screenshot bellow? See expected result


回答1:


Try downloading the file in chunks using the range http header. See https://developers.google.com/drive/v3/web/manage-downloads "Partial download"



来源:https://stackoverflow.com/questions/41464637/google-drive-rest-api-v3-downloading-large-files-with-alt-media-option-25mb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!