0
Upload text in bucket
One script reply has been approved by the moderators Verified

Upload text content at a given path in an s3 resource

Created by admin 625 days ago Viewed 7044 times
0
Submitted by admin Deno
Verified 625 days ago
1
import { S3Client } from "https://deno.land/x/s3_lite_client@0.2.0/mod.ts";
2

3
type S3 = {
4
  endPoint: string;
5
  port: number;
6
  useSSL: boolean;
7
  pathStyle: boolean;
8
  bucket: string;
9
  accessKey: string;
10
  secretKey: string;
11
  region: string;
12
};
13
export async function main(s3: S3, path: string, content: string) {
14
  return await new S3Client(s3).putObject(path, content);
15
}
16