How to use the linkSync function from graceful-fs

Find comprehensive JavaScript graceful-fs.linkSync code examples handpicked from public code repositorys.

467
468
469
470
471
472
473
474
475
476
477
478
exports.fsync = Promise.promisify(fs.fsync);
exports.fsyncSync = fs.fsyncSync;


// link
exports.link = Promise.promisify(fs.link);
exports.linkSync = fs.linkSync;


// listDir
exports.listDir = listDir;
exports.listDirSync = listDirSync;
fork icon9
star icon48
watch icon0

+ 7 other calls in file

34
35
36
37
38
39
40
41
42
43
    if (err.code !== 'EXDEV') throw err
    return moveSyncAcrossDevice(src, dest, overwrite)
  }
} else {
  try {
    fs.linkSync(src, dest)
    return fs.unlinkSync(src)
  } catch (err) {
    if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
      return moveSyncAcrossDevice(src, dest, overwrite)
fork icon0
star icon1
watch icon0

46
47
48
49
50
51
52
53
54
55
56
57
    throw err
  }


  const dir = path.dirname(dstpath)
  const dirExists = fs.existsSync(dir)
  if (dirExists) return fs.linkSync(srcpath, dstpath)
  mkdir.mkdirsSync(dir)


  return fs.linkSync(srcpath, dstpath)
}
fork icon0
star icon0
watch icon1

+ 11 other calls in file