From d4c5e5643705c4f60ab1a0dc1c9f71983c5dd0b1 Mon Sep 17 00:00:00 2001 From: Jared Furlow Date: Sat, 11 Oct 2025 13:58:18 -0500 Subject: [PATCH] Temp --- dist/index.js | 14 ++++++++++---- src/index.ts | 12 ++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7f2e6db..32e7b5b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49,15 +49,18 @@ app.post("/uploadVideo", async (req, res) => { if (stderr && stderr.length > 0) console.log("FFmpeg stderr:", stderr); await minioClient.fPutObject("videos-garage", videoId, formattedPath); console.log(`Size - Old: ${fs.statSync(targetPath).size / (1024 * 1024)} New: ${fs.statSync(formattedPath).size / (1024 * 1024)}`); - fs.unlinkSync(targetPath); - fs.unlinkSync(formattedPath); console.log(await minioClient.presignedGetObject("videos-garage", videoId, 24 * 60 * 60)); console.log(""); }).catch((error) => { console.log("FFmpeg caught error:", error); }).finally(() => { console.log(`Completed processing ${fileInfo.filename}`); - fs.unlinkSync(targetPath); + try { + fs.unlinkSync(targetPath); + fs.unlinkSync(formattedPath); + } catch (err) { + console.log(err); + } currentlyExecFfmpeg = false; }); res.send({ @@ -68,7 +71,10 @@ app.post("/uploadVideo", async (req, res) => { }); req.pipe(req.busboy); } catch (err) { - res.status(500).send(err); + res.status(500).send({ + status: "bad", + statusMessage: err + }); } }); app.listen(3001); diff --git a/src/index.ts b/src/index.ts index 1fe2ffc..da4925b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,8 +79,7 @@ app.post("/uploadVideo", async (req, res) => { fs.statSync(targetPath).size / (1024 * 1024) } New: ${fs.statSync(formattedPath).size / (1024 * 1024)}` ); - fs.unlinkSync(targetPath); - fs.unlinkSync(formattedPath); + console.log( await minioClient.presignedGetObject( "videos-garage", @@ -95,7 +94,12 @@ app.post("/uploadVideo", async (req, res) => { }) .finally(() => { console.log(`Completed processing ${fileInfo.filename}`); - fs.unlinkSync(targetPath); + try { + fs.unlinkSync(targetPath); + fs.unlinkSync(formattedPath); + } catch (err) { + console.log(err); + } currentlyExecFfmpeg = false; }); @@ -104,7 +108,7 @@ app.post("/uploadVideo", async (req, res) => { }); req.pipe(req.busboy); } catch (err) { - res.status(500).send(err); + res.status(500).send({ status: "bad", statusMessage: err }); } }); //