UNPKG

714 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const fs = require("fs");
4const path = require("path");
5function exportList(clients, { save }) {
6 const data = JSON.stringify(clients);
7 if (save) {
8 const filepath = save;
9 ensureDir(filepath);
10 fs.writeFileSync(filepath, data);
11 }
12 console.log(data);
13}
14exports.exportList = exportList;
15/* istanbul ignore next */ //todo update node to v 10.x and user fs.mkdirSync({recursive: true})
16function ensureDir(filePath) {
17 var dirname = path.dirname(filePath);
18 if (fs.existsSync(dirname)) {
19 return true;
20 }
21 ensureDir(dirname);
22 fs.mkdirSync(dirname);
23}
24//# sourceMappingURL=list.js.map
\No newline at end of file