summaryrefslogtreecommitdiff
path: root/src/misc/create-temp.ts
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-03-21 04:50:44 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-03-21 04:50:44 +0900
commit7bebea087cc35b95c4065c1dd9f554a8ec002771 (patch)
treeb8aea8cff25858cb9061eeeca11df83464cb42f9 /src/misc/create-temp.ts
parentFix NoteReaction (#4547) (diff)
downloadsharkey-7bebea087cc35b95c4065c1dd9f554a8ec002771.tar.gz
sharkey-7bebea087cc35b95c4065c1dd9f554a8ec002771.tar.bz2
sharkey-7bebea087cc35b95c4065c1dd9f554a8ec002771.zip
Fix #4546 (#4548)
* Refactor download * emoji type
Diffstat (limited to 'src/misc/create-temp.ts')
-rw-r--r--src/misc/create-temp.ts10
1 files changed, 10 insertions, 0 deletions
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]);
+ });
+ });
+}