3a7182bfb5
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * Update SignupApiService.ts * wip * wip * Update ClientServerService.ts * wip * wip * wip * Update WellKnownServerService.ts * wip * wip * update des * wip * Update ApiServerService.ts * wip * update deps * Update WellKnownServerService.ts * wip * update deps * Update ApiCallService.ts * Update ApiCallService.ts * Update ApiServerService.ts
24 lines
519 B
TypeScript
24 lines
519 B
TypeScript
import * as tmp from 'tmp';
|
|
|
|
export function createTemp(): Promise<[string, () => void]> {
|
|
return new Promise<[string, () => void]>((res, rej) => {
|
|
tmp.file((e, path, fd, cleanup) => {
|
|
if (e) return rej(e);
|
|
res([path, cleanup]);
|
|
});
|
|
});
|
|
}
|
|
|
|
export function createTempDir(): Promise<[string, () => void]> {
|
|
return new Promise<[string, () => void]>((res, rej) => {
|
|
tmp.dir(
|
|
{
|
|
unsafeCleanup: true,
|
|
},
|
|
(e, path, cleanup) => {
|
|
if (e) return rej(e);
|
|
res([path, cleanup]);
|
|
},
|
|
);
|
|
});
|
|
}
|