2015-07-09 23:01:43 +01:00
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
|
|
|
|
2015-08-23 19:12:59 +01:00
|
|
|
function range(start, stop) {
|
2015-08-23 22:12:32 +01:00
|
|
|
const result = [];
|
|
|
|
for (let idx = start.charCodeAt(0), end = stop.charCodeAt(0); idx <= end; ++idx) {
|
2015-07-09 23:01:43 +01:00
|
|
|
result.push(String.fromCharCode(idx));
|
|
|
|
}
|
|
|
|
return result;
|
2015-08-23 19:12:59 +01:00
|
|
|
}
|
2015-07-09 23:01:43 +01:00
|
|
|
|
2015-08-30 18:35:05 +02:00
|
|
|
const storePath = process.env.UPLOAD_STORAGE_PATH;
|
2015-07-09 23:01:43 +01:00
|
|
|
|
|
|
|
const directories = range('A', 'Z').concat(range('a', 'z'), range('0', '9'));
|
|
|
|
|
2015-08-23 19:12:59 +01:00
|
|
|
export default function init() {
|
2015-07-09 23:01:43 +01:00
|
|
|
directories.forEach((directory) => {
|
|
|
|
if (!fs.existsSync(path.join(storePath, directory))) {
|
|
|
|
fs.mkdirSync(path.join(storePath, directory));
|
|
|
|
fs.mkdirSync(path.join(storePath, directory, '150'));
|
|
|
|
fs.mkdirSync(path.join(storePath, directory, '970'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-08-11 12:53:42 +01:00
|
|
|
|
|
|
|
fs.mkdirSync(path.join('/export', 'hostr'));
|