1.3.0 • Published 8 months ago
@storecraft/storage-s3-compatible v1.3.0
Storecraft S3 compatible storage
fetch ready support for an S3 like storage:
Amazon S3Cloudflare R2DigitalOcean SpacesminIOservers
Features:
- Works in any
jsruntime and platform that supportsfetch - Supports streaming
Get/Put/Delete - Supports
presignedGet/Putrequests to offload to client
npm i @storecraft/storage-s3-compatibleAWS S3
import { App } from '@storecraft/core';
import { S3 } from '@storecraft/storage-s3-compatible'
const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
new S3(
{
forcePathStyle: FORCE_PATH_STYLE,
bucket: process.env.S3_BUCKET,
region: process.env.S3_REGION,
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_KEY
}
)
).init();config
Storecraft will search the following env variables
S3_BUCKET=...
S3_REGION=...
S3_ACCESS_KEY_ID=...
S3_SECRET_KEY=...So, you can instantiate with empty config
.withStorage(
new S3()
)Cloudflare R2
import { App } from '@storecraft/core';
import { R2 } from '@storecraft/storage-s3-compatible'
const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
new R2(
{
account_id: process.env.CF_ACCOUNT_ID,
bucket: process.env.S3_BUCKET,
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
}
)
).init();config
Storecraft will search the following env variables
CF_ACCOUNT_ID=...
S3_BUCKET=...
S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...So, you can instantiate with empty config
.withStorage(
new R2()
)Any S3 compatible storage (minio for example)
import { App } from '@storecraft/core';
import { S3CompatibleStorage } from '@storecraft/storage-s3-compatible'
const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
new S3CompatibleStorage(
{
endpoint: process.env.S3_ENDPOINT,
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
bucket: process.env.S3_BUCKET,
region: process.env.S3_REGION
forcePathStyle: true,
}
)
).init();config
Storecraft will search the following env variables
S3_ENDPOINT=...
S3_BUCKET=...
S3_REGION=...
S3_ACCESS_KEY_ID=...
S3_SECRET_KEY=...So, you can instantiate with empty config
.withStorage(
new S3CompatibleStorage()
)Author: Tomer Shalev (tomer.shalev@gmail.com)1.0.18
9 months ago
1.0.17
10 months ago
1.0.16
10 months ago
1.2.5
9 months ago
1.3.0
8 months ago
1.0.15
10 months ago
1.0.14
10 months ago
1.0.13
11 months ago
1.0.12
11 months ago
1.0.9
12 months ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.11
11 months ago
1.0.10
12 months ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
2 years ago