UNPKG

1.1 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.isDirectory = exports.isFile = void 0;
11const fs_1 = require("fs");
12/** @deprecated Since v11.0, unused by the Angular tooling */
13function 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}
26exports.isFile = isFile;
27/** @deprecated Since v11.0, unused by the Angular tooling */
28function 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}
41exports.isDirectory = isDirectory;