@kne/fastify-file-manager 2.0.9 → 2.0.11

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.
@@ -48,6 +48,7 @@ module.exports = fp(async (fastify, options) => {
48
48
  hash.update(buffer);
49
49
  writeStream.write(buffer);
50
50
  fileSize = buffer.byteLength;
51
+ writeStream.end();
51
52
  } else {
52
53
  throw new Error('文件类型不支持');
53
54
  }
@@ -298,7 +299,7 @@ module.exports = fp(async (fastify, options) => {
298
299
  for (const file of fileList) {
299
300
  const filepath = path.resolve(tmpPath, file.filename);
300
301
  const writeStream = fs.createWriteStream(filepath);
301
- const fileStream = getFileReadStream(file);
302
+ const fileStream = await getFileReadStream(file);
302
303
  fileStream.pipe(writeStream);
303
304
  await new Promise((resolve, reject) => {
304
305
  writeStream.on('finish', resolve);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-file-manager",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "用于管理静态文件上传查看等",
5
5
  "main": "index.js",
6
6
  "scripts": {