jbilcke-hf HF staff commited on
Commit
fc983d4
1 Parent(s): df346d9
Files changed (1) hide show
  1. src/index.mts +5 -0
src/index.mts CHANGED
@@ -93,17 +93,22 @@ function setupDirectories() {
93
  }
94
 
95
  async function handleFileStorage(dataFile: fileUpload.UploadedFile | string, projectTempDir: string) {
 
 
96
  if (dataFile instanceof Buffer) {
 
97
  fs.writeFile(path.join(projectTempDir, "data.mp4"), dataFile, (err) => {
98
  if (err) throw err;
99
  });
100
  } else if (typeof dataFile === "object" && dataFile.mv) {
 
101
  try {
102
  await dataFile.mv(path.join(projectTempDir, dataFile.name));
103
  } catch (error) {
104
  throw new Error(`File can't be moved: ${error}`);
105
  }
106
  } else {
 
107
  throw new Error("Invalid File");
108
  }
109
  }
 
93
  }
94
 
95
  async function handleFileStorage(dataFile: fileUpload.UploadedFile | string, projectTempDir: string) {
96
+ console.log(`handleFileStorage called (projectTempDir: ${projectTempDir})`);
97
+ console.log("typeof dataFile: " + typeof dataFile);
98
  if (dataFile instanceof Buffer) {
99
+ console.log("dataFile is a Buffer!");
100
  fs.writeFile(path.join(projectTempDir, "data.mp4"), dataFile, (err) => {
101
  if (err) throw err;
102
  });
103
  } else if (typeof dataFile === "object" && dataFile.mv) {
104
+ console.log(`typeof dataFile === "object" && dataFile.mv`);
105
  try {
106
  await dataFile.mv(path.join(projectTempDir, dataFile.name));
107
  } catch (error) {
108
  throw new Error(`File can't be moved: ${error}`);
109
  }
110
  } else {
111
+ console.log(`unrecognized dataFile format`);
112
  throw new Error("Invalid File");
113
  }
114
  }