- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
// storage -> user -> project -> task -> attachments
var userPath = path.join(basePath, userId);
var projectPath = path.join(userPath, projectId);
var taskPath = path.join(userPath, taskId);
// happy mkdir... happy mkdir!
try {
try {
fs.statSync(taskPath); // task folder exists
}
catch (err) {
try {
fs.statSync(projectPath); // project folder exists
}
catch (err) {
try {
fs.statSync(userPath); // user folder exists
}
catch (err) {
fs.mkdirSync(userPath);
}
fs.mkdirSync(projectPath);
}
fs.mkdirSync(taskPath);
}
}
catch (err) {
return next(err);
}