HOW DID I FORGET
This commit is contained in:
parent
a56ad847ff
commit
1c7b486946
1 changed files with 8 additions and 0 deletions
8
index.js
8
index.js
|
@ -15,6 +15,10 @@ var formats = {
|
||||||
"matroska": "mkv"
|
"matroska": "mkv"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(path.join(__dirname, 'uploads'))) {
|
||||||
|
fs.rmSync(path.join(__dirname, 'uploads'), { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
var uploads = multer({ dest: 'uploads/' })
|
var uploads = multer({ dest: 'uploads/' })
|
||||||
|
|
||||||
const characters = "abcdefghijklmnopqrstuvwxyz!@$%^*()[]_-=+ "
|
const characters = "abcdefghijklmnopqrstuvwxyz!@$%^*()[]_-=+ "
|
||||||
|
@ -51,6 +55,10 @@ app.post("/convert", uploads.single("files"), (req, res) => {
|
||||||
res.setHeader('Content-Disposition', `attachment; filename="${file.originalname.substring(0, file.originalname.lastIndexOf('.'))}.${formats[format] || format}"`);
|
res.setHeader('Content-Disposition', `attachment; filename="${file.originalname.substring(0, file.originalname.lastIndexOf('.'))}.${formats[format] || format}"`);
|
||||||
|
|
||||||
ffmpegProcess.stdio[1].pipe(res)
|
ffmpegProcess.stdio[1].pipe(res)
|
||||||
|
|
||||||
|
.on("close", () => {
|
||||||
|
fs.rmSync(file.path)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get("/download", async (req, res) => {
|
app.get("/download", async (req, res) => {
|
||||||
|
|
Loading…
Reference in a new issue