https://github.com/ahmadarif/adonis-drive-google
Google Storage Driver for Adonis Drive
https://github.com/ahmadarif/adonis-drive-google
adonis-drive adonisjs google-cloud-storage storage-driver
Last synced: 5 months ago
JSON representation
Google Storage Driver for Adonis Drive
- Host: GitHub
- URL: https://github.com/ahmadarif/adonis-drive-google
- Owner: ahmadarif
- License: mit
- Created: 2018-05-03T07:35:30.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-26T02:28:57.000Z (over 7 years ago)
- Last Synced: 2025-08-09T01:05:00.891Z (11 months ago)
- Topics: adonis-drive, adonisjs, google-cloud-storage, storage-driver
- Language: JavaScript
- Size: 16.6 KB
- Stars: 22
- Watchers: 3
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# adonis-drive-google 💾
[](https://badge.fury.io/js/adonis-drive-google)
[](https://www.npmjs.com/package/adonis-drive-google)
[](https://www.npmjs.com/package/adonis-drive-google)
Google Cloud Storage driver for AdonisJS Drive
# Requirements
- [AdonisJS Drive](https://github.com/adonisjs/adonis-drive) (`adonis install @adonisjs/drive`)
# Installation
```
adonis install adonis-drive-google
```
# Instructions
Make sure to register the provider inside `start/app.js` file.
```js
const providers = [
...
'adonis-drive-google/providers/DriveProvider'
]
```
Add new configuration inside `disks` module in `config/drive.js`:
```js
gcs: {
driver: 'gcs',
keyFilename: Env.get('GCS_KEY_FILE_NAME'), // path to json file
bucket: Env.get('GCS_BUCKET')
}
```
Add google cloud storage variables in `.env`:
```
GCS_KEY_FILE_NAME=
GCS_BUCKET=
```
# Examples
## Find if a file exists or not.
```js
const isExists = await Drive.disk('gcs').exists('adonis.jpeg')
```
## Change bucket
You can change bucket at runtime, just passing the bucket name before action.
```js
const isExists = await Drive.disk('minio').bucket('new-bucket').exists('adonis.jpeg')
```
Complete example please go to [this link](examples/routes.js)
# Thanks
Special thanks to the creator(s) of [AdonisJS](http://adonisjs.com/) for creating such a great framework.