68948

Use of node.js with Google Drive API insert / upload

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?

Answer1:

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); }); });

Answer2:

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

Answer3:

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.

Recommend

  • Any pointers on using AngularFire2 With GAPI to Access Google Analytics Reporting
  • Google Sign In API: isSignedIn.get() returning inconsistent values
  • Set Date Range in gapi class for analytics
  • Write from Google Firebase to Google Sheets using Google Apps script
  • How to get the index of element in the List in c#
  • command line of process by name
  • How to load Q library with Require.js?
  • Converter from SAT to 3-SAT
  • Excel VBA How to populate a multi-dimensional (3d) array with values from multiple excel ranges?
  • Primefaces lazy datascroller calling load twice
  • uml Composition relationships to RDF and OWL
  • Private IP address in reserved subnet range
  • Azure table store snapshot/backup capability
  • How do I signal completion of my dataflow?
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • how to avoid repetitive constructor in children
  • xtable package: Skipping some rows in the output
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • Parsing a CSV string while ignoring commas inside the individual columns
  • Spark fat jar to run multiple versions on YARN
  • Avoid links criss cross / overlap in d3.js using force layout
  • Change JButton Shape while respecting Look And Feel
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • script to move all files from one location to another location
  • Symfony2: How to get request parameter
  • ActionScript 2 vs ActionScript 3 performance
  • json Serialization in asp
  • log4net write single file for each call to log.info
  • Error creating VM instance in Google Compute Engine
  • Getting error when using KSoap library to consume .NET web services
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Linking SubReports Without LinkChild/LinkMaster
  • Busy indicator not showing up in wpf window [duplicate]
  • Binding checkboxes to object values in AngularJs
  • Why do underscore prefixed variables exist?
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?