Skip to content

Commit

Permalink
fix: async wrapper for putObject (#525)
Browse files Browse the repository at this point in the history
Пробуем асинхронную обертку для putObject
  • Loading branch information
SevereCloud authored Dec 18, 2024
1 parent 39171f4 commit 6afabf5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions VKUI/s3/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';

import * as core from '@actions/core';
import { S3, S3ClientConfig } from '@aws-sdk/client-s3';
import { PutObjectCommandInput, S3, S3ClientConfig } from '@aws-sdk/client-s3';
import lodash from 'lodash';
import { lookup } from 'mime-types';

Expand Down Expand Up @@ -57,6 +57,11 @@ class Action {
this.bucket = core.getInput('awsBucket', req);
}

private async putObject(args: PutObjectCommandInput) {
const output = await this.s3.putObject(args);
return output;
}

private async upload(src: string, dist: string) {
core.info('Command upload');

Expand All @@ -72,7 +77,7 @@ class Action {
const bucketPath = path.join(dist, path.relative(sourceDir, file));

core.debug(`put ${files.length}`);
return this.s3.putObject({
return this.putObject({
Bucket: this.bucket,
ACL: 'public-read',
Body: fileStream,
Expand Down

0 comments on commit 6afabf5

Please sign in to comment.