Google Drive Rest API V3 Downloading large files w

2019-07-22 10:59发布

问题:

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"