631716053a
closes #10174 - Introduced upload middleware that cleans up temporary files stored by mutler after the request is finished - Removed redundant fs.remove calls as this work is now handled in newly introduced middleware
20 lines
480 B
JavaScript
20 lines
480 B
JavaScript
const storage = require('../../adapters/storage');
|
|
|
|
module.exports = {
|
|
docName: 'upload',
|
|
image: {
|
|
statusCode: 201,
|
|
permissions: false,
|
|
query(frame) {
|
|
const store = storage.getStorage();
|
|
|
|
if (frame.files) {
|
|
return Promise
|
|
.map(frame.files, file => store.save(file))
|
|
.then(paths => paths[0]);
|
|
}
|
|
return store.save(frame.file);
|
|
}
|
|
}
|
|
};
|