mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix storage.put(stream)
This commit is contained in:
1 parent
803c3f4925
commit
2bd1e522d4
2 files changed
+4
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.16.2",
|
||||
"version": "3.16.3",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -10,7 +10,7 @@ import { BucketItem, Client, ItemBucketMetadata } from 'minio';
|
||||
import { Logger } from '../logger';
|
||||
import { builtinConfig } from '../settings';
|
||||
import { MaybeArray } from '../typeutils';
|
||||
import { md5 } from '../utils';
|
||||
import { md5, streamToBuffer } from '../utils';
|
||||
|
||||
const logger = new Logger('storage');
|
||||
|
||||
@@ -261,7 +261,8 @@ class LocalStorageService {
|
||||
target = resolve(this.dir, target);
|
||||
await ensureDir(dirname(target));
|
||||
if (typeof file === 'string') await copyFile(file, target);
|
||||
else await writeFile(target, file);
|
||||
else if (file instanceof Buffer) await writeFile(target, file);
|
||||
else await writeFile(target, await streamToBuffer(file));
|
||||
}
|
||||
|
||||
async get(target: string, path?: string) {
|
||||
|
||||
Reference in new issue
Block a user