1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.isDirectory = exports.isFile = void 0;
|
11 | const fs_1 = require("fs");
|
12 |
|
13 | function isFile(filePath) {
|
14 | let stat;
|
15 | try {
|
16 | stat = fs_1.statSync(filePath);
|
17 | }
|
18 | catch (e) {
|
19 | if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
20 | return false;
|
21 | }
|
22 | throw e;
|
23 | }
|
24 | return stat.isFile() || stat.isFIFO();
|
25 | }
|
26 | exports.isFile = isFile;
|
27 |
|
28 | function isDirectory(filePath) {
|
29 | let stat;
|
30 | try {
|
31 | stat = fs_1.statSync(filePath);
|
32 | }
|
33 | catch (e) {
|
34 | if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
35 | return false;
|
36 | }
|
37 | throw e;
|
38 | }
|
39 | return stat.isDirectory();
|
40 | }
|
41 | exports.isDirectory = isDirectory;
|