These samples allow you to list, download, and upload files from Google Drive.
Set the following values in oauth2.keys.json
(up one directory):
client_id
project_id
client_secret
Run the quickstart.js
sample:
This sample will list the files in the user's Google Drive.
You'll need to do the following before you can run this sample:
- Enable the Google Drive API.
- Set the redirect API in the Google Cloud Console application registration to
http://localhost:3000/oauth2callback
.
node quickstart.js
Run the download.js
sample:
Run the quickstart.js
sample to get a list of files in your Google Drive.
node download.js <fileId>
where <fileId>
is the id of any file in Google Drive.
Example:
node download.js 0B_Klegupc5gUcXhFZjZVUV9NeE0
Run the export.js
sample:
node export.js <fileId>=
where <fileId>
is the id of a Google Doc in Google Drive.
Example:
node export.js 0B_Klegupc5gUcXhFZjZVUV9NeE0 ./file.pdf