Skip to main content

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

ParamTypeDescription
rootstringdefines the absolute path of the disk root path
jailbooleanwhen set to true, it only allows access to files and directories inside the root path
bucketstringThe name of the s3 bucket
endPointstringThe domain or host of the s3 compatible service
accessKeystringThe access key of a IAM user
secretKeystringThe secret key of a IAM user
portnumber(optional) port number of the endpoint
useSSLboolean(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.