create bucket if not exists

This commit is contained in:
cupcakearmy 2021-12-02 17:57:33 +01:00
parent 5c669bcce9
commit ec67bd8f0a
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F

View File

@ -26,7 +26,11 @@ export class Minio implements Storage {
} }
async init(): Promise<void> { async init(): Promise<void> {
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<NodeJS.ReadableStream> { async readStream(path: string): Promise<NodeJS.ReadableStream> {