mirror of
https://github.com/Mintplex-Labs/vector-admin.git
synced 2026-08-28 04:39:55 -04:00
0aa425ba0a
If user inputs exact match for workspace we should recommend that colleciton be pulled in as opposed to creation of new workspace fires workspace sync job in bg on creation
34 lines
817 B
JavaScript
34 lines
817 B
JavaScript
function setupMulter() {
|
|
const multer = require("multer");
|
|
|
|
// Handle File uploads for auto-uploading.
|
|
const storage = multer.diskStorage({
|
|
destination: function (_, _, cb) {
|
|
const path = require("path");
|
|
const uploadOutput = path.resolve(
|
|
__dirname,
|
|
`../../../document-processor/hotdir`
|
|
);
|
|
cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
const upload = multer({
|
|
storage,
|
|
fileFilter: function (req, file, callback) {
|
|
// Solve the problem of garbled Chinese names
|
|
file.originalname = Buffer.from(file.originalname, "latin1").toString(
|
|
"utf8"
|
|
);
|
|
callback(null, true);
|
|
},
|
|
});
|
|
return { handleUploads: upload };
|
|
}
|
|
|
|
module.exports = {
|
|
setupMulter,
|
|
};
|