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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue