@storecraft/storage-google
v1.3.0
Published
Official Google Storage adapter for storecraft
Maintainers
Readme
Storecraft Google Cloud Storage
Storecraft supports the Google Storage services. The service is
serverless friendly. Through the @storecraft/storage-google package.
Features:
- Works in any
jsruntime and platform that supportsfetch - Supports streaming
Get/Put/Delete - Supports
presignedGet/Putrequests to offload to client
How-to
- Create a bucket at
GCP consoleor even atfirebase - Download the
service json file
Use the values of the service file.
Note:
- You can use an empty constructor and upon
StoreCraftinit, the platform environment variables will be used by this storage if needed.
Usage
npm i @storecraft/storage-googlethen,
import { App } from '@storecraft/core';
import { GoogleStorage } from '@storecraft/storage-google';
const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
new GoogleStorage(
{
bucket: process.env.GS_BUCKET,
client_email: process.env.GS_CLIENT_EMAIL,
private_key: process.env.GS_PRIVATE_KEY,
private_key_id: process.env.GS_PRIVATE_KEY_ID
}
)
).init();
config
Storecraft will search the following env variables
GS_BUCKET=...
GS_CLIENT_EMAIL=...
GS_PRIVATE_KEY=...
GS_PRIVATE_KEY_ID=...So, you can instantiate with empty config
.withStorage(
new GoogleStorage()
)Author: Tomer Shalev ([email protected])