mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
452 B
17 lines
452 B
5 years ago
|
'use strict';
|
||
|
|
||
5 years ago
|
const { remove } = require('fs-extra')
|
||
|
, uploadDirectory = require(__dirname+'/uploadDirectory.js')
|
||
5 years ago
|
|
||
5 years ago
|
module.exports = (files) => {
|
||
5 years ago
|
|
||
5 years ago
|
//delete all the files and thumbs
|
||
|
return Promise.all(files.map(async file => {
|
||
5 years ago
|
return Promise.all([
|
||
5 years ago
|
remove(`${uploadDirectory}/file/${file.filename}`),
|
||
4 years ago
|
file.hasThumb ? remove(`${uploadDirectory}/file/thumb/${file.hash}${file.thumbextension}`) : void 0,
|
||
5 years ago
|
]).catch(e => console.error);
|
||
5 years ago
|
}));
|
||
|
|
||
|
}
|