This commit is contained in:
Jared Furlow 2025-10-11 13:58:18 -05:00
parent cb449f3834
commit d4c5e56437
2 changed files with 18 additions and 8 deletions

14
dist/index.js vendored
View File

@ -49,15 +49,18 @@ app.post("/uploadVideo", async (req, res) => {
if (stderr && stderr.length > 0) console.log("FFmpeg stderr:", stderr); if (stderr && stderr.length > 0) console.log("FFmpeg stderr:", stderr);
await minioClient.fPutObject("videos-garage", videoId, formattedPath); await minioClient.fPutObject("videos-garage", videoId, formattedPath);
console.log(`Size - Old: ${fs.statSync(targetPath).size / (1024 * 1024)} New: ${fs.statSync(formattedPath).size / (1024 * 1024)}`); 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(await minioClient.presignedGetObject("videos-garage", videoId, 24 * 60 * 60));
console.log(""); console.log("");
}).catch((error) => { }).catch((error) => {
console.log("FFmpeg caught error:", error); console.log("FFmpeg caught error:", error);
}).finally(() => { }).finally(() => {
console.log(`Completed processing ${fileInfo.filename}`); console.log(`Completed processing ${fileInfo.filename}`);
fs.unlinkSync(targetPath); try {
fs.unlinkSync(targetPath);
fs.unlinkSync(formattedPath);
} catch (err) {
console.log(err);
}
currentlyExecFfmpeg = false; currentlyExecFfmpeg = false;
}); });
res.send({ res.send({
@ -68,7 +71,10 @@ app.post("/uploadVideo", async (req, res) => {
}); });
req.pipe(req.busboy); req.pipe(req.busboy);
} catch (err) { } catch (err) {
res.status(500).send(err); res.status(500).send({
status: "bad",
statusMessage: err
});
} }
}); });
app.listen(3001); app.listen(3001);

View File

@ -79,8 +79,7 @@ app.post("/uploadVideo", async (req, res) => {
fs.statSync(targetPath).size / (1024 * 1024) fs.statSync(targetPath).size / (1024 * 1024)
} New: ${fs.statSync(formattedPath).size / (1024 * 1024)}` } New: ${fs.statSync(formattedPath).size / (1024 * 1024)}`
); );
fs.unlinkSync(targetPath);
fs.unlinkSync(formattedPath);
console.log( console.log(
await minioClient.presignedGetObject( await minioClient.presignedGetObject(
"videos-garage", "videos-garage",
@ -95,7 +94,12 @@ app.post("/uploadVideo", async (req, res) => {
}) })
.finally(() => { .finally(() => {
console.log(`Completed processing ${fileInfo.filename}`); console.log(`Completed processing ${fileInfo.filename}`);
fs.unlinkSync(targetPath); try {
fs.unlinkSync(targetPath);
fs.unlinkSync(formattedPath);
} catch (err) {
console.log(err);
}
currentlyExecFfmpeg = false; currentlyExecFfmpeg = false;
}); });
@ -104,7 +108,7 @@ app.post("/uploadVideo", async (req, res) => {
}); });
req.pipe(req.busboy); req.pipe(req.busboy);
} catch (err) { } catch (err) {
res.status(500).send(err); res.status(500).send({ status: "bad", statusMessage: err });
} }
}); });
// //