Adonis.js-Google-Cloud-Storrage
This library provides an easy way to use Google Cloud Storage in AdonisJS v4. It provides a wrapper around the @google-cloud/storage package.
Install
npm install --save adonis-google-cloud-storage
Configure
Set up your (Google Cloud Storage account)[https://cloud.google.com/storage/] and put your Google Cloud Key file in the root of your application.
Create a config/gcs.js
: like so:
'use strict' const Helpers = moduleexports = projectId: Env // Get this from your Google Cloud Storage console. keyFile: Helpers // name of your google cloud key file bucketName: Env // Get this from your Google Cloud Storage console. pathPrefix: Env // This is useful if you have several projects using the same storage bucket. You can specify the prefix path for each one.
Sample Usage
'use strict' const AdonisGCS = const validateAll = async { const validation = await if validation return responsestatus422 const filefile_name = requestall const adonisGCS = const fileName fileType = adonisGCS return response } moduleexports = ImageUploadController
Thanks
Special thanks to the creator(s) of AdonisJS for creating such a great framework.