[英]How to download a file as Blob from google drive using API
I have been working on a code that will download a blob from the google drive using their API(V3).我一直在研究一个代码,它将使用他们的 API(V3)从谷歌驱动器下载一个 blob。 I want to get this working as I need to duplicate the file from google drive to firebase storage by using the fileUrl/ fileID.
我想让这个工作,因为我需要使用 fileUrl/fileID 将文件从谷歌驱动器复制到 firebase 存储。
I am able to export the pdf file after following a blog on medium在关注medium上的博客后,我能够导出 pdf 文件
To do this you need to:为此,您需要:
webContentLink
and open it to download the file. webContentLink
并打开它以下载文件。 If you were to curl it you would get the file contents.// Create a root reference
var storageRef = firebase.storage().ref();
// Create a reference to 'mountains.jpg'
var mountainsRef = storageRef.child('mountains.jpg');
var file = ... // use the Blob you got on step 1
ref.put(file).then(function(snapshot) {
console.log('Uploaded a blob or file!');
});
Hope this helps!希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.