Forgot to remove more unnessacary
This commit is contained in:
parent
583dfc4608
commit
44890c02ea
2 changed files with 1 additions and 8 deletions
6
index.js
6
index.js
|
@ -35,11 +35,8 @@ app.use(bodyParser.urlencoded({ extended: false }))
|
|||
|
||||
app.post("/convert", uploads.single("files"), (req, res) => {
|
||||
var file = req.file
|
||||
var preset = req.body.preset || 'veryfast'
|
||||
var format = req.body.format || 'mp4'
|
||||
|
||||
console.log(file)
|
||||
|
||||
const ffmpegProcess = cp.spawn(ffmpeg, [
|
||||
'-i', file.path,
|
||||
'-f', format,
|
||||
|
@ -53,12 +50,11 @@ app.post("/convert", uploads.single("files"), (req, res) => {
|
|||
'pipe', 'pipe', 'pipe', 'pipe', 'pipe',
|
||||
],
|
||||
})
|
||||
console.log(fs.statSync(file.path).size)
|
||||
|
||||
res.setHeader('Content-Disposition', `attachment; filename="${file.originalname.substring(0, file.originalname.lastIndexOf('.'))}.${formats[format] || format}"`);
|
||||
ffmpegProcess.stdio[1].pipe(res)
|
||||
|
||||
.on("close", () => {
|
||||
console.log("A")
|
||||
fs.rmSync(file.path)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue