match saveToTempFile return type with other create-temp function

This commit is contained in:
Hazelnoot 2025-05-08 16:42:16 -04:00
parent 17a9b08f54
commit e75e4f11a2
2 changed files with 3 additions and 3 deletions

View file

@ -30,11 +30,11 @@ export function createTempDir(): Promise<[string, () => void]> {
}); });
} }
export async function saveToTempFile(stream: NodeJS.ReadableStream): Promise<string> { export async function saveToTempFile(stream: NodeJS.ReadableStream): Promise<[string, () => void]> {
const [filepath, cleanup] = await createTemp(); const [filepath, cleanup] = await createTemp();
try { try {
await pipeline(stream, fs.createWriteStream(filepath)); await pipeline(stream, fs.createWriteStream(filepath));
return filepath; return [filepath, cleanup];
} catch (e) { } catch (e) {
cleanup(); cleanup();
throw e; throw e;

View file

@ -54,7 +54,7 @@ export class ServerUtilityService {
} }
} else { // Otherwise it's a file } else { // Otherwise it's a file
try { try {
const filepath = await saveToTempFile(part.file); const [filepath] = await saveToTempFile(part.file);
const tmpUploads = (request.tmpUploads ??= []); const tmpUploads = (request.tmpUploads ??= []);
tmpUploads.push(filepath); tmpUploads.push(filepath);