Skip to content

Commit 4463d02

Browse files
authored
Merge pull request #3 from stackbox-dev/fix/minio-checksum-header
fix(file-store): disable default checksum calculation for MinIO
2 parents cbb8fd2 + 290b5ac commit 4463d02

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"dependencies": {
3434
"@aws-sdk/client-s3": "^3.1013.0",
3535
"@aws-sdk/credential-provider-node": "^3.972.23",
36+
"@aws-sdk/lib-storage": "^3.1013.0",
3637
"@azure/identity": "^4.13.1",
3738
"@azure/service-bus": "^7.9.5",
3839
"@azure/storage-blob": "^12.31.0",

src/file-store.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as os from "node:os";
33
import * as path from "node:path";
44
import * as stream from "node:stream";
55
import * as S3 from "@aws-sdk/client-s3";
6+
import { Upload } from "@aws-sdk/lib-storage";
67
import * as AzureIden from "@azure/identity";
78
import { defaultProvider } from "@aws-sdk/credential-provider-node";
89
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
@@ -363,14 +364,16 @@ class S3FileStore implements FileStore {
363364
contentType: string,
364365
localFilepath: string,
365366
) {
366-
await this.client.send(
367-
new S3.PutObjectCommand({
367+
const upload = new Upload({
368+
client: this.client,
369+
params: {
368370
Bucket: this.bucket,
369371
Key: filepath,
370372
Body: fs.createReadStream(localFilepath),
371373
ContentType: contentType,
372-
}),
373-
);
374+
},
375+
});
376+
await upload.done();
374377
}
375378

376379
async getAsStream(filepath: string): Promise<NodeJS.ReadableStream> {
@@ -391,14 +394,16 @@ class S3FileStore implements FileStore {
391394
contentType: string,
392395
rs: stream.Readable,
393396
): Promise<void> {
394-
await this.client.send(
395-
new S3.PutObjectCommand({
397+
const upload = new Upload({
398+
client: this.client,
399+
params: {
396400
Bucket: this.bucket,
397401
Key: filepath,
398402
Body: rs,
399403
ContentType: contentType,
400-
}),
401-
);
404+
},
405+
});
406+
await upload.done();
402407
}
403408

404409
async getInfo(filepath: string): Promise<FileInfo | null> {

0 commit comments

Comments
 (0)