import-qduoj: fix

This commit is contained in:
undefined committed 2021-01-17 09:29:35 +08:00
1 parent 991ffa6c86
commit 84d7e1b95d
6 files changed
+18 -13

No files matched your search

+2 -1
View File
@@ -2,6 +2,7 @@ import { Readable } from 'stream';
import assert from 'assert';
import { URL } from 'url';
import { Client, BucketItem, ItemBucketMetadata } from 'minio';
import { createReadStream } from 'fs-extra';
import { Logger } from '../logger';
import { streamToBuffer } from '../utils';
@@ -103,7 +104,7 @@ class StorageService {
}
async put(target: string, file: string | Buffer | Readable, meta: ItemBucketMetadata = {}) {
if (typeof file === 'string') return await this.client.fPutObject(this.opts.bucket, target, file, meta);
if (typeof file === 'string') file = createReadStream(file);
return await this.client.putObject(this.opts.bucket, target, file, meta);
}