mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
feat: interface HydroFileSystem
This commit is contained in:
1 parent
a58c36961f
commit
9aedeb33b3
5 files changed
+24
-7
No files matched your search
@@ -26,7 +26,7 @@ export async function add(
|
||||
const w = gridfs.openUploadStream(filename);
|
||||
await coll.insertOne({
|
||||
...meta,
|
||||
_id: w.id as ObjectID,
|
||||
_id: w.id,
|
||||
secret: String.random(32),
|
||||
owner,
|
||||
filename,
|
||||
@@ -37,8 +37,8 @@ export async function add(
|
||||
stream.pipe(w);
|
||||
});
|
||||
const c = await gridfs.find({ _id: w.id }).toArray();
|
||||
await coll.updateOne({ _id: w.id as ObjectID }, { $set: { md5: c[0].md5, size: c[0].length } });
|
||||
return w.id as ObjectID;
|
||||
await coll.updateOne({ _id: w.id }, { $set: { md5: c[0].md5, size: c[0].length } });
|
||||
return w.id;
|
||||
}
|
||||
|
||||
export function del(_id: ObjectID) {
|
||||
|
||||
Reference in new issue
Block a user