Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

Can I execute code on Google Drive server infra?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...