mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-01-10 15:40:57 -07:00
Refactor
This commit is contained in:
parent
b14a395b50
commit
3e28c7eaa8
1 changed files with 2 additions and 2 deletions
|
@ -266,11 +266,11 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi
|
||||||
}
|
}
|
||||||
rej(new Error('un-compatible file.'));
|
rej(new Error('un-compatible file.'));
|
||||||
})
|
})
|
||||||
.then(([path, remove]): Promise<any> => new Promise((res, rej) => {
|
.then(([path, shouldCleanup]): Promise<any> => new Promise((res, rej) => {
|
||||||
addFile(user, path, ...args)
|
addFile(user, path, ...args)
|
||||||
.then(file => {
|
.then(file => {
|
||||||
res(file);
|
res(file);
|
||||||
if (remove) {
|
if (shouldCleanup) {
|
||||||
fs.unlink(path, (e) => {
|
fs.unlink(path, (e) => {
|
||||||
if (e) log(e.stack);
|
if (e) log(e.stack);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue