aboutsummaryrefslogtreecommitdiff
path: root/src/server/DashUploadUtils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-05-10 10:08:50 -0400
committerbobzel <zzzman@gmail.com>2023-05-10 10:08:50 -0400
commitebb846116af9c7e65a9d674c765c71c0bf0a7d29 (patch)
treed8278e7c27f7577eb5b4706604144940d12a718e /src/server/DashUploadUtils.ts
parentf912a233a89c8772b22b71d34830ff4b0ba82310 (diff)
parent719da9462f02fd3afda9b0b65de19de9405ab4fc (diff)
Merge branch 'master' into UI_Update_Eric_Ma
Diffstat (limited to 'src/server/DashUploadUtils.ts')
-rw-r--r--src/server/DashUploadUtils.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index f461cf3fa..070d49ec3 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -70,7 +70,14 @@ export namespace DashUploadUtils {
// make a list of paths to create the ordered text file for ffmpeg
const filePathsText = filePaths.map(filePath => `file '${filePath}'`).join('\n');
// write the text file to the file system
- writeFile(textFilePath, filePathsText, err => console.log(err));
+ await new Promise<void>((res, reject) =>
+ writeFile(textFilePath, filePathsText, err => {
+ if (err) {
+ reject();
+ console.log(err);
+ } else res();
+ })
+ );
// make output file name based on timestamp
const outputFileName = `output-${Utils.GenerateGuid()}.mp4`;
@@ -86,7 +93,10 @@ export namespace DashUploadUtils {
.outputOptions('-c copy')
//.videoCodec("copy")
.save(outputFilePath)
- .on('error', reject)
+ .on('error', (err: any) => {
+ console.log(err);
+ reject();
+ })
.on('end', resolve);
});