From b91b866e25be38c095ae2e08b805082ec6d6eb01 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Tue, 1 Oct 2024 14:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20pref:=20=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E5=93=94=E5=93=A9=E5=93=94=E5=93=A9=20=E4=B8=93=E6=A0=8F?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91=20&&=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E5=88=87=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 8b84063..1353957 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -483,7 +483,6 @@ export class tools extends plugin { * @param second */ async sendStreamSegment(e, stream_url, second = this.streamDuration) { - const pipelineAsync = promisify(pipeline); const outputFilePath = `${ this.getCurDownloadPath(e) }/stream_10s.flv`; await checkAndRemoveFile(outputFilePath); @@ -492,13 +491,14 @@ export class tools extends plugin { logger.info("[R插件][发送直播流] 正在下载直播流..."); const file = fs.createWriteStream(outputFilePath); - await pipelineAsync(response.data, file); + response.data.pipe(file); // 设置 streamDuration 秒后停止下载 setTimeout(async () => { logger.info(`[R插件][发送直播流] 直播下载 ${ this.streamDuration } 秒钟到,停止下载!`); response.data.destroy(); // 销毁流 await this.sendVideoToUpload(e, outputFilePath); + file.close(); }, second * 1000); } catch (error) { logger.error(`下载失败: ${ error.message }`);