@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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-file-manager",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "用于管理静态文件上传查看等",
5
5
  "main": "index.js",
6
6
  "scripts": {