Google Drive Rest API V3使用alt = media选项下载大文件(> 25MB) [英] Google Drive Rest API V3 Downloading large files with alt=media option (>25MB)

查看:125
本文介绍了Google Drive Rest API V3使用alt = media选项下载大文件(> 25MB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何通过Google Drive API V3在浏览器中直接下载大文件.

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

我正在使用选项1,即:下载文件— alt = media文件资源的files.get

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

当我发送请求时( https://www .googleapis.com/drive/v3/files/[fileId]?alt = media ),我得到了文件的内容作为其响应.

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.

当前,我正在使用查询的响应来创建blob文件,然后读取该blob文件以开始在浏览器上进行下载.

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.

问题是,读取blob文件会占用大量内存,如果文件大小超过10MB,则会导致浏览器崩溃.

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.

所以我的问题是:如何才能通过Google API在浏览器上开始下载,如下面的截图所示? 查看预期结果

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

推荐答案

尝试使用range http标头分批下载文件.请参见 https://developers.google.com/drive/v3/web/manage -下载部分下载"

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

这篇关于Google Drive Rest API V3使用alt = media选项下载大文件(> 25MB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆