1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const fs = require("fs");
|
4 | const path = require("path");
|
5 | function 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 | }
|
14 | exports.exportList = exportList;
|
15 |
|
16 | function 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 |
|
\ | No newline at end of file |