S3
The S3 driver lets you access files in an S3 bucket.
Installation
npm install typefs-s3-driver
Registration
import { Storage, Configuration } from 'typefs';
import { S3Factory } from 'typefs-s3-driver';
Storage.registerDriver('s3', S3Factory);
Configuration
The s3 driver takes six configuration parameters:
Storage.config = {
disks: {
"s3": {
"driver": "s3",
"root": "/",
"jail": true,
"bucket": process.env.S3_BUCKET || 'my-s3-bucket',
"endPoint": process.env.S3_ENDPOINT || 's3.amazonaws.com',
"accessKey": process.env.S3_ACCESS_KEY || 'minio-access-key',
"secretKey": process.env.S3_SECRET_KEY || 'minio-secret-key',
}
}
Paramaters
Param | Type | Description |
---|---|---|
root | string | defines the absolute path of the disk root path |
jail | boolean | when set to true, it only allows access to files and directories inside the root path |
bucket | string | The name of the s3 bucket |
endPoint | string | The domain or host of the s3 compatible service |
accessKey | string | The access key of a IAM user |
secretKey | string | The secret key of a IAM user |
port | number | (optional) port number of the endpoint |
useSSL | boolean | (optional) [default: true] set to false when testing locally |
caution
When using the s3 disk driver be sure to use a path which is relative to the root specified.
caution
This driver emulates move.