summaryrefslogtreecommitdiff
path: root/src/misc/create-temp.ts
blob: 04604cf7d04f52ec01f5e2fa720e892b533fe1b7 (plain)
1
2
3
4
5
6
7
8
9
10
import * as tmp from 'tmp';

export function createTemp(): Promise<[string, any]> {
	return new Promise<[string, any]>((res, rej) => {
		tmp.file((e, path, fd, cleanup) => {
			if (e) return rej(e);
			res([path, cleanup]);
		});
	});
}