0.2.1 • Published 3 years ago

@ruanitto/adonis-drive-google v0.2.1

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

@ruanitto/adonis-drive-google 💾

Google Cloud Storage driver for AdonisJS Drive

Requirements

Installation

adonis install @ruanitto/adonis-drive-google

Instructions

Make sure to register the provider inside start/app.js file.

const providers = [
  ...
  '@ruanitto/adonis-drive-google/providers/DriveProvider'
]

Add new configuration inside disks module in config/drive.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.

const isExists = await Drive.disk('gcs').exists('adonis.jpeg')

Change bucket

You can change bucket at runtime, just passing the bucket name before action.

const isExists = await Drive.disk('minio').bucket('new-bucket').exists('adonis.jpeg')

Complete example please go to this link

Thanks

Special thanks to the creator(s) of AdonisJS for creating such a great framework.

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago