work.suroh.tk/node_modules/@nodelib/fs.stat/out/providers/sync.js

23 lines
618 B
JavaScript
Raw Normal View History

2019-12-02 12:22:45 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function read(path, settings) {
const lstat = settings.fs.lstatSync(path);
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
return lstat;
}
try {
const stat = settings.fs.statSync(path);
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
return stat;
}
catch (error) {
if (!settings.throwErrorOnBrokenSymbolicLink) {
return lstat;
}
throw error;
}
}
exports.read = read;