mirror of
https://github.com/certd/certd.git
synced 2026-04-15 13:32:37 +08:00
17 lines
360 B
TypeScript
17 lines
360 B
TypeScript
import fs from "fs";
|
|
function getFileRootDir(rootDir?: string) {
|
|
if (rootDir == null) {
|
|
const userHome = process.env.HOME || process.env.USERPROFILE;
|
|
rootDir = userHome + "/.certd/storage/";
|
|
}
|
|
|
|
if (!fs.existsSync(rootDir)) {
|
|
fs.mkdirSync(rootDir, { recursive: true });
|
|
}
|
|
return rootDir;
|
|
}
|
|
|
|
export const fileUtils = {
|
|
getFileRootDir,
|
|
};
|