@kne/fastify-file-manager 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -276,6 +276,12 @@ module.exports = fp(async (fastify, options) => {
|
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
|
|
279
|
+
const getFileInstance = async ({ id, uuid }) => {
|
|
280
|
+
return await models.fileRecord.findOne({
|
|
281
|
+
where: { uuid: uuid || id }
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
|
|
279
285
|
Object.assign(services, {
|
|
280
286
|
uploadToFileSystem,
|
|
281
287
|
uploadFromUrl,
|
|
@@ -286,6 +292,7 @@ module.exports = fp(async (fastify, options) => {
|
|
|
286
292
|
renameFile,
|
|
287
293
|
getFileBlob,
|
|
288
294
|
getFileStream, // 兼容之前api,后面可能会删掉
|
|
295
|
+
getFileInstance,
|
|
289
296
|
fileRecord: {
|
|
290
297
|
uploadToFileSystem,
|
|
291
298
|
uploadFromUrl,
|
|
@@ -295,7 +302,8 @@ module.exports = fp(async (fastify, options) => {
|
|
|
295
302
|
deleteFiles,
|
|
296
303
|
renameFile,
|
|
297
304
|
getFileBlob,
|
|
298
|
-
getFileStream
|
|
305
|
+
getFileStream,
|
|
306
|
+
getFileInstance
|
|
299
307
|
}
|
|
300
308
|
});
|
|
301
309
|
});
|