From 19edff6054053ec141b2a9886743ac680c49dbda Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 10 Apr 2018 02:20:06 +0900 Subject: [PATCH] Refactor --- src/services/drive/upload-from-url.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/drive/upload-from-url.ts b/src/services/drive/upload-from-url.ts index 676586cd1..b3bb47033 100644 --- a/src/services/drive/upload-from-url.ts +++ b/src/services/drive/upload-from-url.ts @@ -19,7 +19,7 @@ export default async (url, user, folderId = null, uri = null): Promise void, rej) => { + const path = await new Promise((res, rej) => { tmp.file((e, path) => { if (e) return rej(e); res(path); @@ -44,8 +44,8 @@ export default async (url, user, folderId = null, uri = null): Promise { - if (e) log(e.stack); + fs.unlink(path, e => { + if (e) console.error(e); }); return driveFile;