1.2.2 • Published 1 year ago
@apolitical/storage v1.2.2
Apolitical Storage
Node.js module to manipulate Apolitical's GCS (Google Cloud Storage) objects
Requirements
Requires the following to run:
Installation
Install with yarn:
yarn add @apolitical/storageUsage
First of all, include @apolitical/storage module:
const apoliticalStorage = require('@apolitical/storage');The recommended way to use @apolitical/storage is to create your own storage instance with the appropriate parameters:
const opts = { bucketName: 'some-bucket-name' };
const storageInstance = apoliticalStorage(opts);The download function
The download function allows you to download an object from GCS:
- It accepts the
filePathparameter. - It returns the
fileBufferobject (Node.js Buffer class)
const fileBuffer = await storageInstance.download('some/file/path.jpg');The upload function
The download function allows you to upload an object to GCS:
- It accepts the
filePathandfileBufferparameters. - It returns the
fileURLstring.
const fileURL = await storageInstance.upload(''some/file/path.jpg', fileBuffer);1.2.2
1 year ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.2-beta.0
3 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.1.0-rc.2
4 years ago
1.1.0-rc.1
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.1.1
4 years ago
0.1.0
5 years ago
0.0.1
5 years ago