diff --git a/index.js b/index.js index 9b19236..cb69bb0 100644 --- a/index.js +++ b/index.js @@ -178,6 +178,12 @@ router.post('/upload', upload.single('file'), async ctx => { expireKey(key) const info = ctx.keys.get(key) + if (info.file && info.file.path) { + await new Promise((resolve, reject) => fs.unlink(info.file.path, (err) => { + if (err) reject(err) + resolve() + })) + } info.file = { name: filename, path: data,