# node-gdrive

> Google driver for node

Latest version **0.1.1** (published 2022-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-gdrive
pnpm add node-gdrive
yarn add node-gdrive
bun add node-gdrive
```

Provides the command `gdrive`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2022-10-07 |
| First published | 2019-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 14 |
| Unpacked size | 29.5 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | KhoaZero123 |
| Maintainers | khoazero123 |
| Keywords | upload, download, google, drive, google drive, drive api, cli, command line, cloud |

## Links

- npm: https://www.npmjs.com/package/node-gdrive
- Repository: https://github.com/khoazero123/node-gdrive
- Issues: https://github.com/khoazero123/node-gdrive/issues
- npm.io page: https://npm.io/package/node-gdrive

## Dependencies (14)

- [md5](https://npm.io/package/md5.md) ^2.2.1
- [open](https://npm.io/package/open.md) ~7.0.2
- [async](https://npm.io/package/async.md) ~3.2.2
- [chalk](https://npm.io/package/chalk.md) ~3.0.0
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [p-map](https://npm.io/package/p-map.md) ^4
- [yargs](https://npm.io/package/yargs.md) ^17.6.0
- [lodash](https://npm.io/package/lodash.md) ~4.17.15
- [moment](https://npm.io/package/moment.md) ~2.29.4
- [express](https://npm.io/package/express.md) ^4.17.1
- [filesize](https://npm.io/package/filesize.md) ~6.0.1
- [streamify](https://npm.io/package/streamify.md) ~1.0.0
- [googleapis](https://npm.io/package/googleapis.md) ^108.0.0
- [server-destroy](https://npm.io/package/server-destroy.md) ^1.0.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2022-10-07
- 0.1.0 — 2022-10-04
- 0.0.18 — 2022-10-03
- 0.0.17 — 2020-09-25
- 0.0.16 — 2020-02-09
- 0.0.15 — 2020-02-09
- 0.0.14 — 2020-02-09
- 0.0.13 — 2020-02-09
- 0.0.12 — 2020-02-09
- 0.0.11 — 2019-08-10
- 0.0.10 — 2019-03-25
- 0.0.9 — 2019-03-23
- 0.0.8 — 2019-03-23
- 0.0.7 — 2019-03-23
- 0.0.6 — 2019-03-23
- … 5 more at https://npm.io/package/node-gdrive/versions

## README

# node-gdrive

Upload file to google drive

## Installation

With [npm](https://www.npmjs.com/) do:

```sh
npm install node-gdrive
```

Use command line global:

```sh
npm install node-gdrive -g
```

## Config

```sh
gdrive token:get # generator new token
```

## Usage

### Node project

```js
const Drive = require("node-gdrive");

// Get token 
const drive = new Drive();
const authUrl = drive.generateAuthUrl();
console.log(`Please go to ${authUrl}`);

var code = '4/1ARtbsJpwJLAnoUT2stmrXABWcmzdvnuF6j_mV3f_ELNQcOrzyqgVz1j0o04';
var token = await drive.reedemCode(code);

// upload file
let filePath = 'foo.txt';

var upload = drive.upload(filePath, {share: true});
upload.on('*', (event, data) => {
  console.log(event, data);
});

// Download file
let fileId = "1eoAgH8xgBkkUDXkTdyPSHSbaJViv33oX";

drive
  .download(fileId, {
    resumable: true, // Resume download session
    force: false, // Override file if exists
    output: './tmp/', // Dir or filepath to save file
  })
  .then(file => {
    console.log("file", file);
  })
  .catch(err => {
    console.error("err", err);
  });

```

#### Commands line

``` sh
gdrive upload file.txt --share user@gmail.com # upload and share file

gdrive donwload 1eoAgH8xgBkkUDXkTdyPSHSbaJViv33oX # download file

gdrive --help
```

## License

MIT

---
_Source: https://npm.io/package/node-gdrive · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
