How to use the readlinkSync function from fs

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

74
75
76
77
78
79
80
81
82
83
exports.readdir = co.promisify(fs.readdir);
exports.readdirSync = fs.readdirSync;
exports.readFile = co.promisify(fs.readFile);
exports.readFileSync = fs.readFileSync;
exports.readlink = co.promisify(fs.readlink);
exports.readlinkSync = fs.readlinkSync;
exports.realpath = co.promisify(fs.realpath);
exports.realpathSync = fs.realpathSync;
exports.rename = co.promisify(fs.rename);
exports.renameSync = fs.renameSync;
fork icon22
star icon45
watch icon26

182
183
184
185
186
187
188
189
190
191
192
193
  };


  fs.readlink(nonexistentFile, common.mustCall(validateError));


  assert.throws(
    () => fs.readlinkSync(nonexistentFile),
    validateError
  );
}

fork icon42
star icon19
watch icon0

7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
    linkTarget = seenLinks[id];
  }
}
if (linkTarget === null) {
  fs.statSync(base);
  linkTarget = fs.readlinkSync(base);
}
resolvedLink = pathModule.resolve(previous, linkTarget);
// track this, if given a cache.
if (cache) cache[base] = resolvedLink;
fork icon0
star icon0
watch icon1

26
27
28
29
30
31
32
33
34
35
36
37
38


  fs.writeFileSync(sourceFile, '');
  fs.symlinkSync(sourceFile, linkFile);


  fs.readlink(linkFile, options, common.mustCall(errHandler));
  fs.readlinkSync(linkFile, options);
}


{
  const fileName = path.resolve(tmpdir.path, 'writeFile');
fork icon0
star icon0
watch icon0

27
28
29
30
31
32
33
34
35
36
37
38
assert.throws(() => {
  fs.readlink('path', options, common.mustNotCall());
}, expectedError);


assert.throws(() => {
  fs.readlinkSync('path', options);
}, expectedError);


assert.throws(() => {
  fs.writeFile('path', 'data', options, common.mustNotCall());
fork icon0
star icon0
watch icon0

10
11
12
13
14
15
16
17
18
19
    code: 'ERR_INVALID_ARG_TYPE',
    name: 'TypeError'
  }
);
assert.throws(
  () => fs.readlinkSync(i),
  {
    code: 'ERR_INVALID_ARG_TYPE',
    name: 'TypeError'
  }
fork icon0
star icon0
watch icon0