How to use the symlink function from fs-extra

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

240
241
242
243
244
245
246
247
248
249
- fs.readlink():读取符号链接的值
- fs.realpath():将相对文件路径指针(.,..)解析为完整路径
- fs.rename():重命名文件或文件夹
- fs.rmdir():删除文件夹
- fs.stat():返回由传递的文件名标识的文件的状态。相关阅读:fs.fstat(),fs.lstat()
- fs.symlink():创建指向文件的新符号链接
- fs.truncate():将传递的文件名标识的文件截断为指定的长度。有关:fs.ftruncate()
- fs.unlink():删除文件或符号链接
- fs.unwatchFile():停止监视文件上的更改
- fs.utimes():更改通过传递的文件名标识的文件的时间戳。有关:fs.futimes()
fork icon0
star icon12
watch icon1

+ 13 other calls in file

7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
    })
  })
}

function makeLink (linkPath, target) {
  fs.symlink(linkPath, target, function (err) {
    if (err) return onError(err)
    return doneOne()
  })
}
fork icon0
star icon1
watch icon0

+ 26 other calls in file

35
36
37
38
39
40
41
42
43
44
const testFile = path.join(testPath, 'test')
const testLink = path.join(testPath, 'testlink')

try {
  await fs.outputFile(testFile, '')
  await fs.symlink(testFile, testLink)
  this.canCreateSymlinks = true
} catch (e) {
  /* istanbul ignore next */
  this.canCreateSymlinks = false
fork icon0
star icon0
watch icon0

+ 8 other calls in file

352
353
354
355
356
357
358
359
360
361
console.error(`Removing ${current}`);
await fs.remove(current);
unlinked = true;
log.write('Running start...\n');
console.log(`|| F: ${deployTo} C: ${current}`);
await fs.symlink(deployTo, current, 'dir');
await spawnScriptInCurrent('deployment/start');
const deploymentsList = fs.readdirSync(deployments).sort();
if (deploymentsList.length > keep) {
  log.write(`Removing ${deploymentsList.length - keep} older deployments, keeping ${keep}\n`);
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)