@uploadx/s3
v7.0.0
Published
Uploadx S3 module
Maintainers
Readme
@uploadx/s3
S3 storage provider for node-uploadx.
Installation
npm install @uploadx/s3Usage (Express)
import express from 'express';
import { uploadx } from '@uploadx/core';
import { S3Storage } from '@uploadx/s3';
const app = express();
const storage = new S3Storage({
bucket: 'my-bucket',
maxFileSize: '512MB',
allowedMimeTypes: ['image/*', 'video/*']
});
app.use('/files', uploadx({ storage }));
app.listen(process.env.PORT || 3002, () => console.log('Server started'));Package-Specific Options
| Option | Type | Description |
| -------------------- | ----------------- | ---------------------------------------------------------- |
| bucket | string | S3 bucket name (env: S3_BUCKET, default: 'node-uploadx') |
| partSize | string\|number | Part size for multipart uploads (min 5MB, default: '16MB') |
| acl | ObjectCannedACL | ACL settings for uploaded objects |
| clientDirectUpload | boolean | Force client to upload directly to S3 via presigned URLs |
| keyFile | string | Path to shared credentials file (deprecated) |
See @uploadx/core and AWS SDK S3 Client for additional options.
Environment Variables
S3_BUCKET— S3 bucket nameS3_ENDPOINT— S3 endpoint URLS3_FORCE_PATH_STYLE— Force path-style addressing (for S3-compatible storage)S3_REGION— RegionS3_KEYFILE— Shared credentials file
Standard AWS SDK credential providers are also supported, for example:
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYAWS_SHARED_CREDENTIALS_FILEAWS_CONFIG_FILEAWS_PROFILEAWS_REGION
Example .env
S3_BUCKET=uploadx
S3_ENDPOINT=https://s3.us-west-002.backblazeb2.com
S3_FORCE_PATH_STYLE=true
S3_KEYFILE=.s3-configFull Documentation
See the main node-uploadx repository for complete documentation.
License
MIT
