Spaces:
Paused
Paused
Commit
•
048dcb2
1
Parent(s):
fc983d4
fix promise issue
Browse files- src/index.mts +4 -3
src/index.mts
CHANGED
@@ -2,12 +2,15 @@ import express, { Request, Response, NextFunction } from "express";
|
|
2 |
import path from "path";
|
3 |
import os from "os";
|
4 |
import fs from "fs";
|
|
|
5 |
import axios from "axios";
|
6 |
import fileUpload from "express-fileupload";
|
7 |
import archiver from "archiver";
|
8 |
import ffmpeg from "fluent-ffmpeg";
|
9 |
import { ColmapOptions, runColmap } from "./colmap.mts";
|
10 |
|
|
|
|
|
11 |
declare module 'express-serve-static-core' {
|
12 |
interface Request {
|
13 |
files: any;
|
@@ -97,9 +100,7 @@ async function handleFileStorage(dataFile: fileUpload.UploadedFile | string, pro
|
|
97 |
console.log("typeof dataFile: " + typeof dataFile);
|
98 |
if (dataFile instanceof Buffer) {
|
99 |
console.log("dataFile is a Buffer!");
|
100 |
-
|
101 |
-
if (err) throw err;
|
102 |
-
});
|
103 |
} else if (typeof dataFile === "object" && dataFile.mv) {
|
104 |
console.log(`typeof dataFile === "object" && dataFile.mv`);
|
105 |
try {
|
|
|
2 |
import path from "path";
|
3 |
import os from "os";
|
4 |
import fs from "fs";
|
5 |
+
import util from "util";
|
6 |
import axios from "axios";
|
7 |
import fileUpload from "express-fileupload";
|
8 |
import archiver from "archiver";
|
9 |
import ffmpeg from "fluent-ffmpeg";
|
10 |
import { ColmapOptions, runColmap } from "./colmap.mts";
|
11 |
|
12 |
+
const writeFile = util.promisify(fs.writeFile);
|
13 |
+
|
14 |
declare module 'express-serve-static-core' {
|
15 |
interface Request {
|
16 |
files: any;
|
|
|
100 |
console.log("typeof dataFile: " + typeof dataFile);
|
101 |
if (dataFile instanceof Buffer) {
|
102 |
console.log("dataFile is a Buffer!");
|
103 |
+
await writeFile(path.join(projectTempDir, "data.mp4"), dataFile);
|
|
|
|
|
104 |
} else if (typeof dataFile === "object" && dataFile.mv) {
|
105 |
console.log(`typeof dataFile === "object" && dataFile.mv`);
|
106 |
try {
|