How to use the readlinkSync function from fs-extra

Find comprehensive JavaScript fs-extra.readlinkSync code examples handpicked from public code repositorys.

7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
      const opts = options
      opts.recursive = true
      copySync(path.join(src, content), path.join(dest, content), opts)
    })
  } else if (options.recursive && stats.isSymbolicLink() && performCopy) {
    const srcPath = fs.readlinkSync(src)
    fs.symlinkSync(srcPath, dest)
  }
}

fork icon0
star icon1
watch icon0

+ 8 other calls in file

110
111
112
113
114
115
116
117
118
119
function setMetadata(path, data, recursive) {
  var stats = fs.lstatSync(path);
  var realpath = path, followSymlink = false;
  if (stats.isSymbolicLink()) {
    // We need to operate on its target, so resolve the symlink
    var target = fs.readlinkSync(path);
    if (target.indexOf('/') === 0) {
      realpath = paths.join(mountDir, target);
    } else {
      realpath = paths.join(paths.dirname(path), target);
fork icon0
star icon1
watch icon2

342
343
344
345
346
347
348
349
350
351
    await spawnScriptInCurrent('deployment/stop');
    stopped = true;
  } catch (e) {
    console.warn('🤔 cannot stop current deployment, that may be OK');
  }
  former = fs.readlinkSync(current);
}
// Unsafe migrations, if any
log.write('Running unsafe migrations...\n');
await spawnInDeployTo('bash', [ 'deployment/migrate' ]);
fork icon0
star icon0
watch icon0

277
278
279
280
281
282
283
284
285
286
const destFile = path.join(targetDir, path.basename(obj.src));

let project_ref;
const link = !!(options && options.link);
if (link) {
    const trueSrc = fs.readlinkSync(destFile);
    project_ref = `Plugins/${fixPathSep(path.relative(fs.realpathSync(project.plugins_dir), trueSrc))}`;
} else {
    project_ref = `Plugins/${fixPathSep(path.relative(project.plugins_dir, destFile))}`;
}
fork icon0
star icon0
watch icon0

23
24
25
26
27
28
29
30
31
32
33
34
}


function resolveSymbolicLink(filePath) {
  const lstat = fs.lstatSync(filePath);
  const resolvedPath = lstat.isSymbolicLink()
    ? path.resolve(path.dirname(filePath), fs.readlinkSync(filePath))
    : false;


  return {
    resolvedPath,
fork icon0
star icon0
watch icon0

26
27
28
29
30
31
32
33
34
35
    const filePath = path.resolve("./packages/package-1/node_modules/package-2");

    fs.lstatSync.mockReturnValueOnce({
      isSymbolicLink: () => true,
    });
    fs.readlinkSync.mockReturnValueOnce(linkRelative(original, filePath));

    expect(resolveSymlink(filePath)).toBe(original);
  });
} else {
fork icon0
star icon0
watch icon0

+ 3 other calls in file

function icon

fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)