1.0.1 • Published 4 years ago
gcs-utils v1.0.1
gcs-utils (Google Cloud Storage)
Utility class for easy integration with Google Cloud Storage API for File Storage and Retrieval.
Underneath uses the official @google-cloud/storage library. If you need all the features consider using the official library.
Available features
- Create Bucket
- Upload file
- Download file
- Delete file
- Get metadata
Usage
Install:
$ npm install gcs-utils --save
or
$ yarn add gcs-utils
Instance and use:
Create private key and store it in a safe place. See more in https://cloud.google.com/iam/docs/creating-managing-service-account-keys
const GCS = require('gcs-utils')
const gcs = new GCS('./data/gc-key.json', 'default-bucket-name')
const result = await gcs.uploadFile('./data/image.jpg')
console.log('result: ', result)
See more in examples