drive-config
A npm module for maintaining user config files (in json) on Google Drive.
npm install drive-config
About
We can take advantage of Google Drive's appdata folder to store a users config data for our application. The user cannot see these files, but can delete config data and revoke our app's access on their Drive by clicking the gear icon in the top right -> Settings -> Manage Apps -> Options Dropdown.
Usage
This module is currently written with ES6 for Node 6+
Setup
var googleAuth = ;let driveConfig = ; // get your user's oauth2Client // more info about setting this up at https://github.com/google/google-api-nodejs-clientlet auth = ;let oauth2Client = clientId clientSecret redirectUrl;oauth2Clientcredentials = usercreds; let driveConfigClient = oauth2Client;
List
Gets all files in a user's google drive for your application
driveConfigClient;
Create
Makes a new files in the user's google drive
driveConfigClient;
Get
Gets a file from a user's google drive with a fileId
driveConfigClient;
Get by name
Gets a list of files that have a specific name
driveConfigClient;
Update
Updates a file on a user's google drive
driveConfigClient;
Destroy
Completely delete's a file from a user's google drive
driveConfigClient;
File Object
// Example of what is returned from most methods id: String name: String data: Object createdTime: Date modifiedTime: Date