用于JavaScript的https://developers.google.com/drive/v2/reference/files/insert上的文档旨在使用客户端JS库。在尝试使用相应的node.js库时,我在调用request()时遇到了问题,因为似乎没有请求()。
除了在不使用库的情况下直接进行网络调用之外,是否有与gapi.client.request()函数等效的函数?
发布于 2013-07-03 15:11:07
在使用nodejs和调用Google drive API时,我也在寻找类似的替代方案。我正在使用googleapi。下面的代码片段可能有助于对API有所了解。
googleapis
.discover('drive', 'v2')
.execute(function(err, client) {
req = client.drive.files.list()
console.log(req);
req.execute(function(err, result) {
console.log(err);
console.log(result);
});
});发布于 2013-06-15 02:48:46
不熟悉Node库,但通常使用Googleapis,您可以使用apiclient发现来构建api服务。
您应该能够使用Node API Client来构建Drive服务,然后在服务对象上调用files.insert方法。https://github.com/google/google-api-nodejs-client/blob/master/lib/googleapis.js
发布于 2015-12-31 05:44:49
这在很大程度上还在进行中,但它确实展示了如何使用官方的node.js googleapis模块。自从我最初提出这个解决方案以来,它们似乎已经取得了很好的进展,所以我可能很快就会更新我的方法和GIST,以使用OAuth2而不是JWT。
VERY basic example of how to save content to Google Drive using node.js using googleapis。
https://stackoverflow.com/questions/17100694
复制相似问题