Temp
This commit is contained in:
parent
cb449f3834
commit
d4c5e56437
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -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);
|
||||
|
||||
12
src/index.ts
12
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 });
|
||||
}
|
||||
});
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user