From 2882ed469d4a27dbb1dc5a3f1057db12514a9147 Mon Sep 17 00:00:00 2001 From: 2046 <2046@ufo.codes> Date: Tue, 25 Apr 2023 09:53:11 +0800 Subject: [PATCH] fix: stream `end` operation failed --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f369a29..97b506c 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,8 @@ export default class FileType extends Transform { _flush (cb) { if (this[kStream] != null) { - this[kStream].end(() => cb(null)) + this[kStream].on('close', () => cb(null)) + this[kStream].destroy() } else { cb(null) }