From ec67bd8f0a91683b06cc1ef4c05c6a7a24674a37 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Thu, 2 Dec 2021 17:57:33 +0100 Subject: [PATCH] create bucket if not exists --- src/storage/minio.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storage/minio.ts b/src/storage/minio.ts index 4eda94d..bf7dca3 100644 --- a/src/storage/minio.ts +++ b/src/storage/minio.ts @@ -26,7 +26,11 @@ export class Minio implements Storage { } async init(): Promise { - await this.client.bucketExists(this.options.bucket) + const exists = await this.client.bucketExists(this.options.bucket) + if (!exists) { + // @ts-ignore + await this.client.makeBucket(this.options.bucket) + } } async readStream(path: string): Promise {