UNPKG

@s-hiroshi/bks

Version:

Cli bookmarks application

25 lines 677 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createStorage = void 0; const fs = require("fs"); const path = require("path"); /** * * @param filePath * @returns */ const createStorage = (filePath) => { if (!fs.existsSync(filePath)) { fs.mkdirSync(path.dirname(filePath), { recursive: true }, (err) => { if (err) throw err; }); fs.writeFileSync(filePath, JSON.stringify({ items: [] }), { flag: "w+" }, (err) => { if (err) throw err; }); } return true; }; exports.createStorage = createStorage; //# sourceMappingURL=createStorage.js.map