@garphild/googledrive-client

1.0.3 • Public • Published

Usage

Init

const { downloadFileById } = await googleApi(path.join(__dirname, 'jwt.keys.json'));

Download file from google drive

const result = await downloadFileById("XXXX-YYY", "./tmp/tmp.jpg");
/**
 * {
 *   status: "success" | "fail",
 *   message: <string> - error message
 *   err: error object
 *   filePath: <string> - path to file
 * }
 */

Promise-based:

googleApi(path.join(__dirname, 'jwt.keys.json'))
  .then((myApi) => {
    const resp = myApi.downloadFileById('15j2wx4QHnLTKMVJnwsxjSm-z7uPP2lfN', './tmp/main2.jpg');
    return resp;
  })
  .then((resp) => {
    ...
    /**
     * {
     *   status: "success" | "fail",
     *   message: <string> - error message
     *   err: error object
     *   filePath: <string> - path to file
     * }
     */
  })
  .catch((e) => {
    ...
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @garphild/googledrive-client

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.17 kB

Total Files

10

Last publish

Collaborators

  • garphild