1.13.0 • Published 2 years ago

@premiumfastnet/google-drive v1.13.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Google Drive (NodeJS)

npm npm GitHub Release Date GitHub issues GitHub pull requests NPM

Simple Interaction to Google Drive using NodeJS + Promises

Important

  • This script make without guarantee.
  • If you found error or something else, please make a new issue or pull request.

Documentation

Installation

  • NPM
npm i @premiumfastnet/google-drive
  • Yarn
yarn add @premiumfastnet/google-drive

Feature and Example Code

To-DO

  • Get Detail Disk Quota
  • Get List Files
  • Get, Copy, Delete Files
  • Empty Trash
  • Share Files to Email (Private) or Public
  • Create and Delete Directory
  • Upload Single File With Progress Bar
  • Download Files With Progress

Best Practise How to Use Nested Function

  • This example will explain how to generate a new token and continue to next request function
  • We can define multiple function in one way.
  • In first time we set a user token, then we make a function for check quota, then all of this will execute after we refresh a token manually.
const gd = new GoogleDrive({
    clientId: credentials.clientId,
    clientSecret: credentials.clientSecret,
    scopes: credentials.scopes,
});

// set user token
const setToken = gd.setToken(credentials.user);

// check quota
const quota = () => {
    gd.checkQuota()
        .then((res) => {
            // your function for save new quota to database
            console.log(res.data);
        })
        .catch((err) => {
            console.log(err);
        });
};

// refresh token manual
const refresh = gd.refreshToken();

refresh
    .then((res) => {
        gd.setToken(res.data);
    })
    .then(() => {
        quota();
    })
    .catch((err) => {
        console.log(err);
    });

INFO

  • By: Juni Yadi @ Premium Fast Network
  • License: MIT
1.13.0

2 years ago

1.12.0

2 years ago

1.11.0

3 years ago

1.10.0

3 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago