如何使用API​​

我一直在研究使用其API(V3)从Google驱动器下载Blob的代码。我想使它正常工作,因为我需要使用fileUrl / fileID将文件从Google驱动器复制到Firebase存储。

关注medium上的博客后,我能够导出pdf文件

niejiangmin123 回答:如何使用API​​

为此,您需要:

  1. Get Drive file blob 您可以获取webContentLink并将其打开以下载文件。如果要卷曲它,您将获得文件内容。
  2. Create a reference to the file
// Create a root reference
var storageRef = firebase.storage().ref();

// Create a reference to 'mountains.jpg'
var mountainsRef = storageRef.child('mountains.jpg');
  1. Upload the Blob to the reference
 var file = ... // use the Blob you got on step 1
 ref.put(file).then(function(snapshot) {
   console.log('Uploaded a blob or file!');
 });

希望这会有所帮助!

本文链接:https://www.f2er.com/3159707.html

大家都在问