From 896f74e0ca983008e24026d771e09f6c2113fd93 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Tue, 10 Nov 2020 01:07:10 +0700 Subject: [PATCH] allow overriding location of chunks Closes #302 --- config.sample.js | 6 ++++++ controllers/pathsController.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config.sample.js b/config.sample.js index 819a4f5..b5c284b 100644 --- a/config.sample.js +++ b/config.sample.js @@ -255,6 +255,12 @@ module.exports = { timeout: 30 * 60 * 1000 // 30 minutes }, + /* + Folder where in-progress chunks should be kept temporarily. + NOTE: When set to falsy value, defaults to "chunks" subfolder within uploads folder. + */ + chunksFolder: null, + /* Max file size allowed for upload by URLs. Needs to be in MB. NOTE: Set to falsy value to disable upload by URLs. diff --git a/controllers/pathsController.js b/controllers/pathsController.js index 987c337..7bbff07 100644 --- a/controllers/pathsController.js +++ b/controllers/pathsController.js @@ -25,7 +25,9 @@ for (const fsFunc of fsFuncs) { } self.uploads = path.resolve(config.uploads.folder) -self.chunks = path.join(self.uploads, 'chunks') +self.chunks = config.uploads.chunksFolder + ? path.resolve(config.uploads.chunksFolder) + : path.join(self.uploads, 'chunks') self.thumbs = path.join(self.uploads, 'thumbs') self.zips = path.join(self.uploads, 'zips')