我可以在Google云端硬盘服务器上执行代码吗? [英] Can I execute code on Google Drive server infra?

查看:634
本文介绍了我可以在Google云端硬盘服务器上执行代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google云端硬盘API是否提供了一种在Google云端硬盘服务器上执行我的代码的方法?



假设我想要编写基于 grep 让客户通过他们的文件进行搜索。
我希望能够写出如下所示的内容:(非常简化,使其简短)

  / * define函数grep * / 
var grep = function(params,callback){
// 1)使用`gapi.client.drive.files.list`查找所有文本文件
// 2)使用`gapi.client.drive.files.get`打开每个文件
// 3)扫描字符串发生的事件
callback(search_result);
}

/ *在虚拟API上注册服务器上的代码* /
gapi.client.drive.server.register('myapp.grep',grep);
$ b $ *从浏览器执行* /
gapi.client.drive.server.myapp.grep({searchString:'Abrakadabra',mimeType:'application / javascript'},
函数(resutls){
console.log(results)
}
);

有很多应用程序类型可以利用这种方法。简单的数据库管理器是另一个例子。

Google Apps脚本 Google App Engine ,它非常接近你想要的。我认为Google云端硬盘不具备该功能。


Does Google Drive API provide a way to execute my code on the Google Drive server infra?

Let's say I want to write Google Dirve based grep to let customer search through thier files. I want to be able to write something like this: (very simplified to make it short)

/* define the function for grep */
var grep = function(params, callback) {
  // 1) find all text files using `gapi.client.drive.files.list`
  // 2) open each file with `gapi.client.drive.files.get`
  // 3) scan for the serach string occurance
  callback(search_result);
}

/* register the code on the server with imaginary API */
gapi.client.drive.server.register('myapp.grep', grep);

/* execute from Browser */
gapi.client.drive.server.myapp.grep({searchString: 'Abrakadabra', mimeType: 'application/javascript'},
  function(resutls) {
    console.log(results)
  }
);

There are tons of application types can take advantage of this approach. Simple DB manager is another example.

解决方案

There is Google Apps Script and Google App Engine which is quiet close to what you want. I don't think Google Drive has that feature.

这篇关于我可以在Google云端硬盘服务器上执行代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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