我正在尝试将 Google Drive 集成到我的 angular 应用程序中,以便我们的用户可以从文档中复制内容并将他们的图像下载到我的应用程序中。根据file:get API Documentation,我使用下面的代码来获取文件
var request = gapi.client.drive.files.get({
'fileId': fileId
});
var temp = this;
request.execute(function (resp) {
});
Run Code Online (Sandbox Code Playgroud)
但在响应中,我只得到文件名和 ID。downloadFile 函数不需要下载 URL。回复:
{kind: "drive#file",
id: "1KxxxxxxxxxxxxxxycMcfp8YWH2I",
name: " Report-November",
mimeType: "application/vnd.google-apps.spreadsheet",
result:{
kind: "drive#file"
id: "1K7DxawpFz_xiEpxxxxxxxblfp8YWH2I"
name: " Report-November"
mimeType: "application/vnd.google-apps.spreadsheet"
}
}
Run Code Online (Sandbox Code Playgroud)
下载文件功能:
/**
* Download a file's content.
*
* @param {File} file Drive File instance.
* @param {Function} callback Function to call when the request is complete.
*/
downloadFile(file, callback) …Run Code Online (Sandbox Code Playgroud) 我util.Scanner用来读取用户的输入.我不明白如何读取长数据类型值.
Scanner scr=new Scanner(System.in);
long l=scr.nextInt();
Run Code Online (Sandbox Code Playgroud)
我无法使用上面的代码读取64位数据 - 它只是给我一个输入不匹配异常.