2 Object.defineProperty(exports, "__esModule", { value: true });
3 function sync(path, options) {
4 const lstat = options.fs.lstatSync(path);
5 if (!isFollowedSymlink(lstat, options)) {
9 const stat = options.fs.statSync(path);
10 stat.isSymbolicLink = () => true;
14 if (!options.throwErrorOnBrokenSymlinks) {
21 function async(path, options, callback) {
22 options.fs.lstat(path, (err0, lstat) => {
24 return callback(err0, undefined);
26 if (!isFollowedSymlink(lstat, options)) {
27 return callback(null, lstat);
29 options.fs.stat(path, (err1, stat) => {
31 return options.throwErrorOnBrokenSymlinks ? callback(err1) : callback(null, lstat);
33 stat.isSymbolicLink = () => true;
38 exports.async = async;
40 * Returns `true` for followed symlink.
42 function isFollowedSymlink(stat, options) {
43 return stat.isSymbolicLink() && options.followSymlinks;
45 exports.isFollowedSymlink = isFollowedSymlink;