Files
timothycarambat 0aa425ba0a Find or create flow for workspaces
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
2023-08-01 16:07:16 -07:00

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,
};