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