mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
match saveToTempFile return type with other create-temp function
This commit is contained in:
parent
17a9b08f54
commit
e75e4f11a2
2 changed files with 3 additions and 3 deletions
|
@ -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();
|
||||
try {
|
||||
await pipeline(stream, fs.createWriteStream(filepath));
|
||||
return filepath;
|
||||
return [filepath, cleanup];
|
||||
} catch (e) {
|
||||
cleanup();
|
||||
throw e;
|
||||
|
|
|
@ -54,7 +54,7 @@ export class ServerUtilityService {
|
|||
}
|
||||
} else { // Otherwise it's a file
|
||||
try {
|
||||
const filepath = await saveToTempFile(part.file);
|
||||
const [filepath] = await saveToTempFile(part.file);
|
||||
|
||||
const tmpUploads = (request.tmpUploads ??= []);
|
||||
tmpUploads.push(filepath);
|
||||
|
|
Loading…
Add table
Reference in a new issue