The documentation at https://developers.google.com/drive/v2/reference/files/insert for JavaScript is intended for use of the client-side JS library. Trying to use the corresponding node.js library, I'm running into problems calling request(), since there doesn't appear to be one.
Short of making the network call directly without use of the library, is there an equivalent for the gapi.client.request() function?
I was also looking for similar alternative when using nodejs and calling Google drive API. I am using googleapi. Following code snippet might help to give idea on 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);
});
});
Not familiar with the Node libary, but typically with Googleapis, you can use the apiclient discovery to build an api service.
You should be able to use the Node API Client to build the Drive service, then call the files.insert method on your service object.
https://github.com/google/google-api-nodejs-client/blob/master/lib/googleapis.js
This is still VERY much a work in progress, but it does show how to use the official node.js googleapis module. It looks like they've made good progress since I originally came up with this solution so I'll likely update my approach and the GIST to use OAuth2 rather than JWT very soon.
VERY basic example of how to save content to Google Drive using node.js using googleapis.