@constructive-io/s3-streamer 2.17.2 → 2.17.4
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/esm/s3.js +2 -4
- package/esm/streamer.js +2 -2
- package/package.json +4 -4
- package/s3.d.ts +1 -1
- package/s3.js +2 -4
- package/streamer.d.ts +2 -2
- package/streamer.js +2 -2
package/esm/s3.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
2
|
export default function getS3(opts) {
|
|
3
|
-
// Use explicit provider if set, otherwise fall back to checking minioEndpoint for backwards compatibility
|
|
4
|
-
const isMinio = opts.provider === 'minio' || (opts.provider === undefined && Boolean(opts.minioEndpoint));
|
|
5
3
|
const awsConfig = {
|
|
6
4
|
region: opts.awsRegion,
|
|
7
5
|
...(opts.awsAccessKey && opts.awsSecretKey
|
|
@@ -12,9 +10,9 @@ export default function getS3(opts) {
|
|
|
12
10
|
},
|
|
13
11
|
}
|
|
14
12
|
: {}),
|
|
15
|
-
...(
|
|
13
|
+
...(opts.endpoint
|
|
16
14
|
? {
|
|
17
|
-
endpoint: opts.
|
|
15
|
+
endpoint: opts.endpoint,
|
|
18
16
|
forcePathStyle: true,
|
|
19
17
|
}
|
|
20
18
|
: {}),
|
package/esm/streamer.js
CHANGED
|
@@ -4,12 +4,12 @@ import { upload as streamUpload, uploadWithContentType as streamUploadWithConten
|
|
|
4
4
|
export class Streamer {
|
|
5
5
|
s3;
|
|
6
6
|
defaultBucket;
|
|
7
|
-
constructor({ awsRegion, awsSecretKey, awsAccessKey,
|
|
7
|
+
constructor({ awsRegion, awsSecretKey, awsAccessKey, endpoint, provider, defaultBucket }) {
|
|
8
8
|
this.s3 = getS3({
|
|
9
9
|
awsRegion,
|
|
10
10
|
awsSecretKey,
|
|
11
11
|
awsAccessKey,
|
|
12
|
-
|
|
12
|
+
endpoint,
|
|
13
13
|
provider
|
|
14
14
|
});
|
|
15
15
|
this.defaultBucket = defaultBucket;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/s3-streamer",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.4",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "stream files to s3",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@constructive-io/s3-utils": "^2.10.2",
|
|
33
|
-
"@pgpmjs/env": "^2.
|
|
33
|
+
"@pgpmjs/env": "^2.17.0",
|
|
34
34
|
"glob": "^13.0.6",
|
|
35
35
|
"makage": "^0.3.0"
|
|
36
36
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@aws-sdk/client-s3": "^3.1009.0",
|
|
39
39
|
"@aws-sdk/lib-storage": "^3.1009.0",
|
|
40
40
|
"@constructive-io/content-type-stream": "^2.11.2",
|
|
41
|
-
"@pgpmjs/types": "^2.
|
|
41
|
+
"@pgpmjs/types": "^2.21.0"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"s3",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"minio",
|
|
49
49
|
"constructive"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "fe60f7b81252eea53dce227bb581d5ae2ef0ec36"
|
|
52
52
|
}
|
package/s3.d.ts
CHANGED
package/s3.js
CHANGED
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = getS3;
|
|
4
4
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
5
|
function getS3(opts) {
|
|
6
|
-
// Use explicit provider if set, otherwise fall back to checking minioEndpoint for backwards compatibility
|
|
7
|
-
const isMinio = opts.provider === 'minio' || (opts.provider === undefined && Boolean(opts.minioEndpoint));
|
|
8
6
|
const awsConfig = {
|
|
9
7
|
region: opts.awsRegion,
|
|
10
8
|
...(opts.awsAccessKey && opts.awsSecretKey
|
|
@@ -15,9 +13,9 @@ function getS3(opts) {
|
|
|
15
13
|
},
|
|
16
14
|
}
|
|
17
15
|
: {}),
|
|
18
|
-
...(
|
|
16
|
+
...(opts.endpoint
|
|
19
17
|
? {
|
|
20
|
-
endpoint: opts.
|
|
18
|
+
endpoint: opts.endpoint,
|
|
21
19
|
forcePathStyle: true,
|
|
22
20
|
}
|
|
23
21
|
: {}),
|
package/streamer.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface StreamerOptions {
|
|
|
6
6
|
awsRegion: string;
|
|
7
7
|
awsSecretKey: string;
|
|
8
8
|
awsAccessKey: string;
|
|
9
|
-
|
|
9
|
+
endpoint?: string;
|
|
10
10
|
provider?: BucketProvider;
|
|
11
11
|
defaultBucket: string;
|
|
12
12
|
}
|
|
@@ -29,7 +29,7 @@ interface UploadWithContentTypeParams {
|
|
|
29
29
|
export declare class Streamer {
|
|
30
30
|
private s3;
|
|
31
31
|
private defaultBucket?;
|
|
32
|
-
constructor({ awsRegion, awsSecretKey, awsAccessKey,
|
|
32
|
+
constructor({ awsRegion, awsSecretKey, awsAccessKey, endpoint, provider, defaultBucket }: StreamerOptions);
|
|
33
33
|
upload({ readStream, filename, key, bucket }: UploadParams): Promise<AsyncUploadResult>;
|
|
34
34
|
uploadWithContentType({ readStream, contentType, key, bucket, magic, }: UploadWithContentTypeParams): Promise<AsyncUploadResult>;
|
|
35
35
|
detectContentType({ readStream, filename, peekBytes, }: {
|
package/streamer.js
CHANGED
|
@@ -10,12 +10,12 @@ const utils_1 = require("./utils");
|
|
|
10
10
|
class Streamer {
|
|
11
11
|
s3;
|
|
12
12
|
defaultBucket;
|
|
13
|
-
constructor({ awsRegion, awsSecretKey, awsAccessKey,
|
|
13
|
+
constructor({ awsRegion, awsSecretKey, awsAccessKey, endpoint, provider, defaultBucket }) {
|
|
14
14
|
this.s3 = (0, s3_1.default)({
|
|
15
15
|
awsRegion,
|
|
16
16
|
awsSecretKey,
|
|
17
17
|
awsAccessKey,
|
|
18
|
-
|
|
18
|
+
endpoint,
|
|
19
19
|
provider
|
|
20
20
|
});
|
|
21
21
|
this.defaultBucket = defaultBucket;
|