summary refs log tree commit diff
path: root/src/cdn/util/S3Storage.ts
diff options
context:
space:
mode:
authorCatalan Lover <48515417+FSG-Cat@users.noreply.github.com>2022-08-23 23:50:01 +0200
committerGitHub <noreply@github.com>2022-08-23 23:50:01 +0200
commitd63451b3fe6c0c6ab175adec82361834bb3633f5 (patch)
treeb738ee25bf9819300e1802ba9a8e2813e9dc2588 /src/cdn/util/S3Storage.ts
parentMerge pull request #1 from FSG-Cat/FSG-Cat-patch-1 (diff)
parentCheck Captcha (diff)
downloadserver-d63451b3fe6c0c6ab175adec82361834bb3633f5.tar.xz
Merge branch 'fosscord:staging' into Bug-Report-Template
Diffstat (limited to 'src/cdn/util/S3Storage.ts')
-rw-r--r--src/cdn/util/S3Storage.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/cdn/util/S3Storage.ts b/src/cdn/util/S3Storage.ts
index c4066817..a7892e5e 100644
--- a/src/cdn/util/S3Storage.ts
+++ b/src/cdn/util/S3Storage.ts
@@ -11,11 +11,7 @@ const readableToBuffer = (readable: Readable): Promise<Buffer> =>
 	});
 
 export class S3Storage implements Storage {
-	public constructor(
-		private client: S3,
-		private bucket: string,
-		private basePath?: string
-	) {}
+	public constructor(private client: S3, private bucket: string, private basePath?: string) {}
 
 	/**
 	 * Always return a string, to ensure consistency.
@@ -28,7 +24,7 @@ export class S3Storage implements Storage {
 		await this.client.putObject({
 			Bucket: this.bucket,
 			Key: `${this.bucketBasePath}${path}`,
-			Body: data,
+			Body: data
 		});
 	}
 
@@ -36,7 +32,7 @@ export class S3Storage implements Storage {
 		try {
 			const s3Object = await this.client.getObject({
 				Bucket: this.bucket,
-				Key: `${this.bucketBasePath ?? ""}${path}`,
+				Key: `${this.bucketBasePath ?? ""}${path}`
 			});
 
 			if (!s3Object.Body) return null;
@@ -54,7 +50,7 @@ export class S3Storage implements Storage {
 	async delete(path: string): Promise<void> {
 		await this.client.deleteObject({
 			Bucket: this.bucket,
-			Key: `${this.bucketBasePath}${path}`,
+			Key: `${this.bucketBasePath}${path}`
 		});
 	}
 }