0.0.11 • Published 9 years ago

gdrive v0.0.11

Weekly downloads
50
License
-
Repository
-
Last release
9 years ago

###How to use:

  1. Make sure you have a google account, and you should create a project in https://console.developers.google.com/.
  2. Enter your project's console homepage, and go into APIs & auth -> Credentials, then add a credentials for your project.
  3. set your Authorized JavaScript origins.
  4. set your Authorized redirect URIs, this url should be put info config.json with Key REDIRECT_URL.
  5. create a config.json locally, just like below:

    {
    	"CLIENT_ID": "your CLIENT_ID",
    	"CLIENT_SECRET": "your CLIENT_ID",
    	"REDIRECT_URL": "http://localhost:80/oauth2callback",
    	"SCOPE": "https://www.googleapis.com/auth/drive"
    }
  6. run the gettoken.js, which is written for getting the access tokens:

    //gettoken.js
    var readline = require('readline');
    var config = require('./config');
    var gdrive = require('gdrive');
    
    var auth = gdrive.createAuthObj(config);
    var url = gdrive.generateAuthUrl(auth, config);
    
    console.log('----copy the url below, and access it by browser:\n\n' + url);
    
    var rl = readline.createInterface({
    	input: process.stdin,
    	output: process.stdout
    });
    
    var getAccessToken = function(code) {
    	common.getToken(auth, code);
    };
    
    rl.question('\n\n----Enter the code here:\n\n', getAccessToken);
  7. run the getfileinfo.js, which is written for getting the files info from google drive:

    //getfileinfo.js
    
    var config = require('./config');
    var token = require('./token');
    var gdrive = require('gdrive');
    
    query = "title != '' ";
    var auth = gdrive.createAuthObj(config, token);
    
    gdrive.QueryFile(auth, query, function(files) {
    	gdrive.PrintFilesInfo(files);
    });
0.0.11

9 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago