mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-10 16:49:42 +00:00
Add noCleanup argument (#95)
* Added noCleanup argument (don't delete temp audio/video files on ffmpeg error) * Added argument to README Co-authored-by: Aleksa Savic <savicaleksa83@gmail.com>
This commit is contained in:
@@ -195,6 +195,9 @@ async function downloadVideo(videoUrls: string[], outputDirectories: string[], s
|
||||
const cleanupFn = function () {
|
||||
pbar.stop();
|
||||
|
||||
if (argv.noCleanup)
|
||||
return;
|
||||
|
||||
try {
|
||||
fs.unlinkSync(outputPath);
|
||||
} catch(e) {}
|
||||
@@ -223,11 +226,7 @@ async function downloadVideo(videoUrls: string[], outputDirectories: string[], s
|
||||
});
|
||||
|
||||
ffmpegCmd.on('error', (error: any) => {
|
||||
pbar.stop();
|
||||
|
||||
try {
|
||||
fs.unlinkSync(outputPath);
|
||||
} catch (e) {}
|
||||
cleanupFn();
|
||||
|
||||
console.log(`\nffmpeg returned an error: ${error.message}`);
|
||||
process.exit(ERROR_CODE.UNK_FFMPEG_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user