Michaël
Michaël

Reputation: 41

Google Drive Rest API V3 Downloading large files (>25MB)

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

According to the Drive API manual there are three different ways to download files via the API:

  1. Download a file — files.get with alt=media file resource
  2. Download and export a Google Doc — files.export
  3. Link a user to a file — webContentLink from the file resource

Option (2) isn't useful in my case as the files aren't Google Docs files and Option (3) isn't a solution as this will redirect the user to a warning that Google Drive can't scan big files for virusses.

This leaves me with option (1). This works almost perfectly and I can successfully redirect the user to the file via the alt=media attribute e.g.:

https://www.googleapis.com/drive/v3/files/0By3zfuC927VWRkJnV3g2aDY4UHM?alt=media&access_token=ya29.XXXXXXXXXXXXX

Although this will start the download in the Browsers, it will be named with the ID of the file instead of the original File Name. Which is quite confusing.

So my question is: How can I download large files (>25MB without virus warning) via the Google API with the right file name?

NOTE 1: Downloading the file via cURL on the server before and sending the output to the browser isn't an option in my case.

NOTE 2: Furthermore, the files can't be shared. That's why I am using the API.

Upvotes: 2

Views: 3753

Answers (1)

Teyam
Teyam

Reputation: 8122

AFAIK, it's currently not supported for files that can't be shared and since web hosting support in Google Drive has been deprecated. (Reference: here)

You may want to check the responses given in the following SO posts for additional information:

Upvotes: 1

Related Questions