Overview:
Yes you can use the tmp package where you can store the video into a specific file pass it to ffmpeg and then clean the file after all processing is completed
Note: I recommend using the tmp-promise since it make it easy to deal with promises
1. Import the package
const tmp = require("tmp-promise");
2. Set the temp dir
// Temp directory const tempDir = await tmp.dir({ unsafeCleanup: true, });
3. Save the file into the system using the tempDir path
// Get The video file const video = req.file; await fs.promises.writeFile( `${tempDir.path}/${video.originalname}`, video.buffer );
4. Process the video
here you can pass the file to the ffmpeg and process the video as you like with your specific need
note: file name is ${tempDir.path}/${video.originalname}
5. Clean up the directory
tempDir.cleanup()