Last change
on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.read = void 0;
|
---|
4 | function read(path, settings, callback) {
|
---|
5 | settings.fs.lstat(path, (lstatError, lstat) => {
|
---|
6 | if (lstatError !== null) {
|
---|
7 | callFailureCallback(callback, lstatError);
|
---|
8 | return;
|
---|
9 | }
|
---|
10 | if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
---|
11 | callSuccessCallback(callback, lstat);
|
---|
12 | return;
|
---|
13 | }
|
---|
14 | settings.fs.stat(path, (statError, stat) => {
|
---|
15 | if (statError !== null) {
|
---|
16 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
---|
17 | callFailureCallback(callback, statError);
|
---|
18 | return;
|
---|
19 | }
|
---|
20 | callSuccessCallback(callback, lstat);
|
---|
21 | return;
|
---|
22 | }
|
---|
23 | if (settings.markSymbolicLink) {
|
---|
24 | stat.isSymbolicLink = () => true;
|
---|
25 | }
|
---|
26 | callSuccessCallback(callback, stat);
|
---|
27 | });
|
---|
28 | });
|
---|
29 | }
|
---|
30 | exports.read = read;
|
---|
31 | function callFailureCallback(callback, error) {
|
---|
32 | callback(error);
|
---|
33 | }
|
---|
34 | function callSuccessCallback(callback, result) {
|
---|
35 | callback(null, result);
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.