1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

replace electron store with lowdb

This commit is contained in:
Kyle Spearrin
2018-05-31 09:07:56 -04:00
parent 98e2e611f8
commit f618c0b5ee
7 changed files with 121 additions and 42 deletions

16
src/misc/nodeUtils.ts Normal file
View File

@@ -0,0 +1,16 @@
import * as fs from 'fs';
import * as path from 'path';
export class NodeUtils {
static mkdirpSync(targetDir: string, mode = 755, relative = false, relativeDir: string = null) {
const initialDir = path.isAbsolute(targetDir) ? path.sep : '';
const baseDir = relative ? (relativeDir != null ? relativeDir : __dirname) : '.';
targetDir.split(path.sep).reduce((parentDir, childDir) => {
const dir = path.resolve(baseDir, parentDir, childDir);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, mode);
}
return dir;
}, initialDir);
}
}