From 39bb23a651992a1487dd2d55e47d7d6f4de43f4c Mon Sep 17 00:00:00 2001 From: Vittorio Palmisano Date: Fri, 12 Apr 2024 20:37:16 +0200 Subject: [PATCH] add missing fd close --- src/vmaf.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vmaf.ts b/src/vmaf.ts index 05220fd..8e79993 100644 --- a/src/vmaf.ts +++ b/src/vmaf.ts @@ -50,6 +50,7 @@ export async function parseIvf( const headerView = new DataView(headerData) const ret = await fd.read(headerView, 0, 32, 0) if (ret.bytesRead !== 32) { + await fd.close() throw new Error('Invalid IVF file') } const width = headerView.getUint16(12, true) @@ -209,9 +210,9 @@ export async function parseIvf( frames = recognizedFrames } - const ptsIndex = Array.from(frames.keys()).sort((a, b) => a - b) - await fd.close() + + const ptsIndex = Array.from(frames.keys()).sort((a, b) => a - b) return { width, height, frameRate, ptsIndex, frames, participantDisplayName } }