mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-09 16:30:10 +01:00
6d651db6d3
* WIP on imports * undo nodismiss for testing * remove old keys modal screen add helper text on import complete * return default setting modal to keys
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
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 =
|
|
process.env.NODE_ENV === "development"
|
|
? path.resolve(__dirname, `../../../collector/hotdir`)
|
|
: path.resolve(process.env.STORAGE_DIR, `../../collector/hotdir`);
|
|
cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
const upload = multer({
|
|
storage,
|
|
});
|
|
return { handleUploads: upload };
|
|
}
|
|
|
|
function setupDataImports() {
|
|
const multer = require("multer");
|
|
// Handle File uploads for auto-uploading.
|
|
const storage = multer.diskStorage({
|
|
destination: function (_, _, cb) {
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
const uploadOutput = path.resolve(__dirname, `../../storage/imports`);
|
|
fs.mkdirSync(uploadOutput, { recursive: true });
|
|
return cb(null, uploadOutput);
|
|
},
|
|
filename: function (_, file, cb) {
|
|
cb(null, file.originalname);
|
|
},
|
|
});
|
|
const upload = multer({
|
|
storage,
|
|
});
|
|
return { handleImports: upload };
|
|
}
|
|
|
|
module.exports = {
|
|
setupMulter,
|
|
setupDataImports,
|
|
};
|