From 7bebea087cc35b95c4065c1dd9f554a8ec002771 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Thu, 21 Mar 2019 04:50:44 +0900 Subject: Fix #4546 (#4548) * Refactor download * emoji type --- src/misc/create-temp.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/misc/create-temp.ts (limited to 'src/misc/create-temp.ts') diff --git a/src/misc/create-temp.ts b/src/misc/create-temp.ts new file mode 100644 index 0000000000..04604cf7d0 --- /dev/null +++ b/src/misc/create-temp.ts @@ -0,0 +1,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]); + }); + }); +} -- cgit v1.2.3-freya