@strapi/provider-upload-aws-s3 5.35.0 → 5.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +260 -9
- package/dist/index.d.ts +107 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +316 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +317 -42
- package/dist/index.mjs.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -3
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +8 -3
- package/dist/utils.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ npm install @strapi/provider-upload-aws-s3 --save
|
|
|
29
29
|
- `ACL` is the access control list for the object. Defaults to `public-read`.
|
|
30
30
|
- `signedUrlExpires` is the number of seconds before a signed URL expires. (See [how signed URLs work](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html)). Defaults to 15 minutes and URLs are only signed when ACL is set to `private`.
|
|
31
31
|
- `Bucket` is the name of the bucket to upload to.
|
|
32
|
+
- `providerOptions.providerConfig` contains extended configuration options (see below).
|
|
32
33
|
- `actionOptions` is passed directly to the parameters to each method respectively. You can find the complete list of [upload/ uploadStream options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property) and [delete options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#deleteObject-property)
|
|
33
34
|
|
|
34
35
|
See the [documentation about using a provider](https://docs.strapi.io/developer-docs/latest/plugins/upload.html#using-a-provider) for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the [documentation about environment variables](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/environment.html#environment-variables).
|
|
@@ -72,6 +73,159 @@ module.exports = ({ env }) => ({
|
|
|
72
73
|
});
|
|
73
74
|
```
|
|
74
75
|
|
|
76
|
+
## Extended Provider Configuration
|
|
77
|
+
|
|
78
|
+
The `providerConfig` option provides additional features for data integrity, security, and cost optimization.
|
|
79
|
+
|
|
80
|
+
### Checksum Validation
|
|
81
|
+
|
|
82
|
+
Enable automatic checksum calculation to ensure data integrity during uploads. The SDK calculates a checksum on the client side, and S3 validates it server-side.
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
providerOptions: {
|
|
86
|
+
s3Options: { /* ... */ },
|
|
87
|
+
providerConfig: {
|
|
88
|
+
checksumAlgorithm: 'CRC64NVME', // Options: 'CRC32', 'CRC32C', 'SHA1', 'SHA256', 'CRC64NVME'
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`CRC64NVME` is recommended for best performance on modern hardware.
|
|
94
|
+
|
|
95
|
+
### Conditional Writes (Prevent Overwrites)
|
|
96
|
+
|
|
97
|
+
Prevent accidental file overwrites due to race conditions by enabling conditional writes. When enabled, uploads will fail if an object with the same key already exists.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
providerConfig: {
|
|
101
|
+
preventOverwrite: true,
|
|
102
|
+
},
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Storage Class Configuration (AWS S3 only)
|
|
106
|
+
|
|
107
|
+
Optimize storage costs by specifying a storage class for uploaded objects. Use lower-cost classes for infrequently accessed data.
|
|
108
|
+
|
|
109
|
+
**Note:** Storage classes are AWS S3-specific. Other S3-compatible providers (MinIO, DigitalOcean Spaces, IONOS, Wasabi) will ignore this setting.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
providerConfig: {
|
|
113
|
+
storageClass: 'INTELLIGENT_TIERING', // Auto-optimizes costs
|
|
114
|
+
},
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Available storage classes (AWS S3):
|
|
118
|
+
|
|
119
|
+
- `STANDARD` - Frequently accessed data (default)
|
|
120
|
+
- `INTELLIGENT_TIERING` - Automatic cost optimization
|
|
121
|
+
- `STANDARD_IA` - Infrequently accessed data
|
|
122
|
+
- `ONEZONE_IA` - Infrequently accessed, single AZ
|
|
123
|
+
- `GLACIER` - Archive storage
|
|
124
|
+
- `DEEP_ARCHIVE` - Long-term archive
|
|
125
|
+
- `GLACIER_IR` - Glacier Instant Retrieval
|
|
126
|
+
|
|
127
|
+
### Server-Side Encryption
|
|
128
|
+
|
|
129
|
+
Configure server-side encryption for compliance requirements (GDPR, HIPAA, etc.).
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
providerConfig: {
|
|
133
|
+
encryption: {
|
|
134
|
+
type: 'AES256', // S3-managed encryption
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For KMS-managed encryption (AWS S3 only):
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
providerConfig: {
|
|
143
|
+
encryption: {
|
|
144
|
+
type: 'aws:kms',
|
|
145
|
+
kmsKeyId: env('AWS_KMS_KEY_ID'),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Available encryption types:
|
|
151
|
+
|
|
152
|
+
- `AES256` - S3-managed keys (SSE-S3) - supported by most S3-compatible providers
|
|
153
|
+
- `aws:kms` - AWS KMS-managed keys (SSE-KMS) - AWS S3 only
|
|
154
|
+
- `aws:kms:dsse` - Dual-layer SSE with KMS - AWS S3 only
|
|
155
|
+
|
|
156
|
+
### Object Tagging
|
|
157
|
+
|
|
158
|
+
Apply tags to uploaded objects for cost allocation, lifecycle policies, and organization.
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
providerConfig: {
|
|
162
|
+
tags: {
|
|
163
|
+
project: 'website',
|
|
164
|
+
environment: 'production',
|
|
165
|
+
team: 'backend',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Multipart Upload Configuration
|
|
171
|
+
|
|
172
|
+
Configure multipart upload behavior for large files.
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
providerConfig: {
|
|
176
|
+
multipart: {
|
|
177
|
+
partSize: 10 * 1024 * 1024, // 10MB per part
|
|
178
|
+
queueSize: 4, // Number of parallel uploads
|
|
179
|
+
leavePartsOnError: false, // Clean up on failure
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Complete Configuration Example
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
module.exports = ({ env }) => ({
|
|
188
|
+
upload: {
|
|
189
|
+
config: {
|
|
190
|
+
provider: 'aws-s3',
|
|
191
|
+
providerOptions: {
|
|
192
|
+
baseUrl: env('CDN_URL'),
|
|
193
|
+
rootPath: env('CDN_ROOT_PATH'),
|
|
194
|
+
s3Options: {
|
|
195
|
+
credentials: {
|
|
196
|
+
accessKeyId: env('AWS_ACCESS_KEY_ID'),
|
|
197
|
+
secretAccessKey: env('AWS_ACCESS_SECRET'),
|
|
198
|
+
},
|
|
199
|
+
region: env('AWS_REGION'),
|
|
200
|
+
params: {
|
|
201
|
+
ACL: 'private',
|
|
202
|
+
signedUrlExpires: 15 * 60,
|
|
203
|
+
Bucket: env('AWS_BUCKET'),
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
providerConfig: {
|
|
207
|
+
checksumAlgorithm: 'CRC64NVME',
|
|
208
|
+
preventOverwrite: true,
|
|
209
|
+
storageClass: 'INTELLIGENT_TIERING',
|
|
210
|
+
encryption: {
|
|
211
|
+
type: 'aws:kms',
|
|
212
|
+
kmsKeyId: env('AWS_KMS_KEY_ID'),
|
|
213
|
+
},
|
|
214
|
+
tags: {
|
|
215
|
+
application: 'strapi',
|
|
216
|
+
environment: env('NODE_ENV'),
|
|
217
|
+
},
|
|
218
|
+
multipart: {
|
|
219
|
+
partSize: 10 * 1024 * 1024,
|
|
220
|
+
queueSize: 4,
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
75
229
|
### Configuration for a private S3 bucket and signed URLs
|
|
76
230
|
|
|
77
231
|
If your bucket is configured to be private, you will need to set the `ACL` option to `private` in the `params` object. This will ensure file URLs are signed.
|
|
@@ -113,7 +267,25 @@ module.exports = ({ env }) => ({
|
|
|
113
267
|
|
|
114
268
|
#### Configuration for S3 compatible services
|
|
115
269
|
|
|
116
|
-
This plugin
|
|
270
|
+
This plugin works with S3-compatible services by using the `endpoint` option. The provider automatically constructs correct URLs for S3-compatible services that return incorrect `Location` formats for multipart uploads (e.g. IONOS, MinIO).
|
|
271
|
+
|
|
272
|
+
**Important:** Some providers require `forcePathStyle: true` in the `s3Options`. This is needed when the provider does not support virtual-hosted-style URLs (e.g. `bucket.endpoint.com`), and instead uses path-style URLs (e.g. `endpoint.com/bucket`).
|
|
273
|
+
|
|
274
|
+
| Provider | `forcePathStyle` | `ACL` | Notes |
|
|
275
|
+
| ------------------- | ---------------- | ----------------- | --------------------------------- |
|
|
276
|
+
| IONOS | `true` | Supported | Multipart Location bug auto-fixed |
|
|
277
|
+
| MinIO | `true` | Supported | |
|
|
278
|
+
| Contabo | `true` | Supported | |
|
|
279
|
+
| Hetzner | `true` | Supported | |
|
|
280
|
+
| DigitalOcean Spaces | Not needed | Supported | |
|
|
281
|
+
| Wasabi | Not needed | Supported | |
|
|
282
|
+
| Scaleway | Not needed | Supported | |
|
|
283
|
+
| Vultr | Not needed | Supported | |
|
|
284
|
+
| Backblaze B2 | Not needed | Supported | |
|
|
285
|
+
| Cloudflare R2 | Not needed | **Not supported** | Omit `ACL` from params |
|
|
286
|
+
|
|
287
|
+
##### Scaleway example
|
|
288
|
+
|
|
117
289
|
`./config/plugins.js`
|
|
118
290
|
|
|
119
291
|
```js
|
|
@@ -123,14 +295,16 @@ module.exports = ({ env }) => ({
|
|
|
123
295
|
config: {
|
|
124
296
|
provider: 'aws-s3',
|
|
125
297
|
providerOptions: {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
298
|
+
s3Options: {
|
|
299
|
+
credentials: {
|
|
300
|
+
accessKeyId: env('SCALEWAY_ACCESS_KEY_ID'),
|
|
301
|
+
secretAccessKey: env('SCALEWAY_ACCESS_SECRET'),
|
|
302
|
+
},
|
|
303
|
+
region: env('SCALEWAY_REGION'), // e.g "fr-par"
|
|
304
|
+
endpoint: env('SCALEWAY_ENDPOINT'), // e.g. "https://s3.fr-par.scw.cloud"
|
|
305
|
+
params: {
|
|
306
|
+
Bucket: env('SCALEWAY_BUCKET'),
|
|
307
|
+
},
|
|
134
308
|
},
|
|
135
309
|
},
|
|
136
310
|
},
|
|
@@ -139,6 +313,58 @@ module.exports = ({ env }) => ({
|
|
|
139
313
|
});
|
|
140
314
|
```
|
|
141
315
|
|
|
316
|
+
##### IONOS / MinIO / Contabo example (forcePathStyle required)
|
|
317
|
+
|
|
318
|
+
```js
|
|
319
|
+
module.exports = ({ env }) => ({
|
|
320
|
+
upload: {
|
|
321
|
+
config: {
|
|
322
|
+
provider: 'aws-s3',
|
|
323
|
+
providerOptions: {
|
|
324
|
+
s3Options: {
|
|
325
|
+
credentials: {
|
|
326
|
+
accessKeyId: env('S3_ACCESS_KEY_ID'),
|
|
327
|
+
secretAccessKey: env('S3_ACCESS_SECRET'),
|
|
328
|
+
},
|
|
329
|
+
region: env('S3_REGION'),
|
|
330
|
+
endpoint: env('S3_ENDPOINT'),
|
|
331
|
+
forcePathStyle: true, // Required for these providers
|
|
332
|
+
params: {
|
|
333
|
+
Bucket: env('S3_BUCKET'),
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
##### Cloudflare R2 example (no ACL support)
|
|
343
|
+
|
|
344
|
+
```js
|
|
345
|
+
module.exports = ({ env }) => ({
|
|
346
|
+
upload: {
|
|
347
|
+
config: {
|
|
348
|
+
provider: 'aws-s3',
|
|
349
|
+
providerOptions: {
|
|
350
|
+
s3Options: {
|
|
351
|
+
credentials: {
|
|
352
|
+
accessKeyId: env('R2_ACCESS_KEY_ID'),
|
|
353
|
+
secretAccessKey: env('R2_ACCESS_SECRET'),
|
|
354
|
+
},
|
|
355
|
+
region: 'auto',
|
|
356
|
+
endpoint: env('R2_ENDPOINT'), // e.g. "https://<account-id>.r2.cloudflarestorage.com"
|
|
357
|
+
params: {
|
|
358
|
+
Bucket: env('R2_BUCKET'),
|
|
359
|
+
// Do NOT set ACL - R2 does not support ACLs
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
142
368
|
### Security Middleware Configuration
|
|
143
369
|
|
|
144
370
|
Due to the default settings in the Strapi Security Middleware you will need to modify the `contentSecurityPolicy` settings to properly see thumbnail previews in the Media Library. You should replace `strapi::security` string with the object bellow instead as explained in the [middleware configuration](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#loading-order) documentation.
|
|
@@ -253,3 +479,28 @@ upload: {
|
|
|
253
479
|
```
|
|
254
480
|
|
|
255
481
|
This configuration ensures compatibility with the updated AWS SDK while providing flexibility in URL format selection, catering to various user needs.
|
|
482
|
+
|
|
483
|
+
## Security Considerations
|
|
484
|
+
|
|
485
|
+
This provider includes several security measures to protect against common attack vectors.
|
|
486
|
+
|
|
487
|
+
### Path Traversal Prevention
|
|
488
|
+
|
|
489
|
+
File paths, hashes, and extensions are sanitized to prevent directory traversal attacks. Sequences like `../` are removed, and special characters in file extensions are filtered.
|
|
490
|
+
|
|
491
|
+
### Parameter Injection Protection
|
|
492
|
+
|
|
493
|
+
The `customParams` option allows passing additional parameters to S3 operations. However, critical security parameters (`Bucket`, `Key`, `Body`) cannot be overridden via `customParams` to prevent unauthorized access to other buckets or objects.
|
|
494
|
+
|
|
495
|
+
### URL Protocol Validation
|
|
496
|
+
|
|
497
|
+
Only `http://` and `https://` protocols are accepted for S3 response URLs. This prevents potential injection of dangerous protocols like `file://`, `javascript:`, or `data:`.
|
|
498
|
+
|
|
499
|
+
### Recommendations
|
|
500
|
+
|
|
501
|
+
1. **Use Private ACL**: Set `ACL: 'private'` for sensitive content and use signed URLs for access.
|
|
502
|
+
2. **Enable Encryption**: Configure server-side encryption for data at rest.
|
|
503
|
+
3. **Enable Checksums**: Use `checksumAlgorithm` to ensure data integrity during uploads.
|
|
504
|
+
4. **Use Conditional Writes**: Enable `preventOverwrite: true` to prevent accidental overwrites.
|
|
505
|
+
5. **Apply Least Privilege**: Use the minimum required IAM permissions listed above.
|
|
506
|
+
6. **Enable Bucket Versioning**: Consider enabling S3 versioning for recovery from accidental deletions.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,36 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import type { ReadStream } from 'node:fs';
|
|
5
|
-
import { DeleteObjectCommandOutput, CompleteMultipartUploadCommandOutput, AbortMultipartUploadCommandOutput, S3ClientConfig, ObjectCannedACL } from '@aws-sdk/client-s3';
|
|
5
|
+
import { DeleteObjectCommandOutput, CompleteMultipartUploadCommandOutput, AbortMultipartUploadCommandOutput, S3ClientConfig, ObjectCannedACL, StorageClass, ServerSideEncryption } from '@aws-sdk/client-s3';
|
|
6
6
|
import type { AwsCredentialIdentity } from '@aws-sdk/types';
|
|
7
|
+
/**
|
|
8
|
+
* Supported checksum algorithms for data integrity validation.
|
|
9
|
+
* CRC64NVME is recommended for best performance on modern hardware.
|
|
10
|
+
*/
|
|
11
|
+
export type SupportedChecksumAlgorithm = 'CRC32' | 'CRC32C' | 'SHA1' | 'SHA256' | 'CRC64NVME';
|
|
12
|
+
/**
|
|
13
|
+
* Supported S3 storage classes for cost optimization.
|
|
14
|
+
*/
|
|
15
|
+
export type SupportedStorageClass = 'STANDARD' | 'REDUCED_REDUNDANCY' | 'STANDARD_IA' | 'ONEZONE_IA' | 'INTELLIGENT_TIERING' | 'GLACIER' | 'DEEP_ARCHIVE' | 'GLACIER_IR';
|
|
16
|
+
/**
|
|
17
|
+
* Server-side encryption types.
|
|
18
|
+
*/
|
|
19
|
+
export type EncryptionType = 'AES256' | 'aws:kms' | 'aws:kms:dsse';
|
|
20
|
+
/**
|
|
21
|
+
* Encryption configuration for server-side encryption.
|
|
22
|
+
*/
|
|
23
|
+
export interface EncryptionConfig {
|
|
24
|
+
type: EncryptionType;
|
|
25
|
+
kmsKeyId?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Multipart upload configuration for large files.
|
|
29
|
+
*/
|
|
30
|
+
export interface MultipartConfig {
|
|
31
|
+
partSize?: number;
|
|
32
|
+
queueSize?: number;
|
|
33
|
+
leavePartsOnError?: boolean;
|
|
34
|
+
}
|
|
7
35
|
export interface File {
|
|
8
36
|
name: string;
|
|
9
37
|
alternativeText?: string;
|
|
@@ -23,37 +51,112 @@ export interface File {
|
|
|
23
51
|
provider_metadata?: Record<string, unknown>;
|
|
24
52
|
stream?: ReadStream;
|
|
25
53
|
buffer?: Buffer;
|
|
54
|
+
etag?: string;
|
|
26
55
|
}
|
|
27
56
|
export type UploadCommandOutput = (CompleteMultipartUploadCommandOutput | AbortMultipartUploadCommandOutput) & {
|
|
28
57
|
Location: string;
|
|
58
|
+
ETag?: string;
|
|
29
59
|
};
|
|
30
60
|
export interface AWSParams {
|
|
31
61
|
Bucket: string;
|
|
32
62
|
ACL?: ObjectCannedACL;
|
|
33
63
|
signedUrlExpires?: number;
|
|
34
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Extended configuration options for the S3 provider.
|
|
67
|
+
*/
|
|
68
|
+
export interface ProviderConfig {
|
|
69
|
+
/**
|
|
70
|
+
* Checksum algorithm for data integrity validation during upload.
|
|
71
|
+
* When enabled, the SDK calculates a checksum and S3 validates it server-side.
|
|
72
|
+
*/
|
|
73
|
+
checksumAlgorithm?: SupportedChecksumAlgorithm;
|
|
74
|
+
/**
|
|
75
|
+
* When true, uploads will fail if an object with the same key already exists.
|
|
76
|
+
* This prevents accidental overwrites due to race conditions.
|
|
77
|
+
*/
|
|
78
|
+
preventOverwrite?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* S3 storage class for uploaded objects.
|
|
81
|
+
* Use lower-cost classes for infrequently accessed data.
|
|
82
|
+
*/
|
|
83
|
+
storageClass?: SupportedStorageClass;
|
|
84
|
+
/**
|
|
85
|
+
* Server-side encryption configuration.
|
|
86
|
+
*/
|
|
87
|
+
encryption?: EncryptionConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Tags to apply to uploaded objects.
|
|
90
|
+
* Useful for cost allocation and lifecycle policies.
|
|
91
|
+
*/
|
|
92
|
+
tags?: Record<string, string>;
|
|
93
|
+
/**
|
|
94
|
+
* Multipart upload configuration for large files.
|
|
95
|
+
*/
|
|
96
|
+
multipart?: MultipartConfig;
|
|
97
|
+
}
|
|
35
98
|
export interface DefaultOptions extends S3ClientConfig {
|
|
36
99
|
accessKeyId?: AwsCredentialIdentity['accessKeyId'];
|
|
37
100
|
secretAccessKey?: AwsCredentialIdentity['secretAccessKey'];
|
|
38
101
|
credentials?: AwsCredentialIdentity;
|
|
39
102
|
params?: AWSParams;
|
|
40
|
-
[k: string]:
|
|
103
|
+
[k: string]: unknown;
|
|
41
104
|
}
|
|
42
105
|
export type InitOptions = (DefaultOptions | {
|
|
43
106
|
s3Options: DefaultOptions;
|
|
44
107
|
}) & {
|
|
45
108
|
baseUrl?: string;
|
|
46
109
|
rootPath?: string;
|
|
47
|
-
|
|
110
|
+
providerConfig?: ProviderConfig;
|
|
111
|
+
[k: string]: unknown;
|
|
48
112
|
};
|
|
49
113
|
declare const _default: {
|
|
50
|
-
init({ baseUrl, rootPath, s3Options, ...legacyS3Options }: InitOptions): {
|
|
114
|
+
init({ baseUrl, rootPath, s3Options, providerConfig, ...legacyS3Options }: InitOptions): {
|
|
115
|
+
/**
|
|
116
|
+
* Returns whether the bucket is configured with private ACL.
|
|
117
|
+
*/
|
|
51
118
|
isPrivate(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the current provider configuration.
|
|
121
|
+
*/
|
|
122
|
+
getProviderConfig(): ProviderConfig | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Generates a signed URL for accessing a private object.
|
|
125
|
+
*/
|
|
52
126
|
getSignedUrl(file: File, customParams: any): Promise<{
|
|
53
127
|
url: string;
|
|
54
128
|
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Uploads a file using streaming.
|
|
131
|
+
*/
|
|
55
132
|
uploadStream(file: File, customParams?: {}): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Uploads a file to S3.
|
|
135
|
+
*/
|
|
56
136
|
upload(file: File, customParams?: {}): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Uploads a file only if it matches the expected ETag (optimistic locking).
|
|
139
|
+
* Throws PreconditionFailed error if ETag does not match.
|
|
140
|
+
*/
|
|
141
|
+
uploadIfMatch(file: File, expectedETag: string, customParams?: {}): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Retrieves object metadata including ETag.
|
|
144
|
+
*/
|
|
145
|
+
getObjectMetadata(file: File): Promise<{
|
|
146
|
+
etag: string | undefined;
|
|
147
|
+
contentLength: number | undefined;
|
|
148
|
+
contentType: string | undefined;
|
|
149
|
+
lastModified: Date | undefined;
|
|
150
|
+
storageClass: StorageClass | undefined;
|
|
151
|
+
serverSideEncryption: ServerSideEncryption | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Checks if an object exists in the bucket.
|
|
155
|
+
*/
|
|
156
|
+
objectExists(file: File): Promise<boolean>;
|
|
157
|
+
/**
|
|
158
|
+
* Deletes an object from S3.
|
|
159
|
+
*/
|
|
57
160
|
delete(file: File, customParams?: {}): Promise<DeleteObjectCommandOutput>;
|
|
58
161
|
};
|
|
59
162
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAIL,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAIL,yBAAyB,EAGzB,oCAAoC,EACpC,iCAAiC,EACjC,cAAc,EACd,eAAe,EAEf,YAAY,EACZ,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAK5D;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,oBAAoB,GACpB,aAAa,GACb,YAAY,GACZ,qBAAqB,GACrB,SAAS,GACT,cAAc,GACd,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IAC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