node-fs-extra/docs/ensureSymlink-sync.md
Mani Maghsoudlou b0eb751a75
Improve docs (#795)
* improve docs

* Update docs/ensureSymlink-sync.md

Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>

* Update docs/ensureSymlink.md

Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>

* add Error type to docs

Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>
2020-05-11 16:40:39 -04:00

617 B

ensureSymlinkSync(srcPath, destPath[, type])

Ensures that the symlink exists. If the directory structure does not exist, it is created.

Alias: createSymlinkSync()

  • srcPath <String>
  • destPath <String>
  • type <String> It is only available on Windows and ignored on other platforms. It can be set to dir, file, or junction.

Example:

const fs = require('fs-extra')

const srcPath = '/tmp/file.txt'
const destPath = '/tmp/this/path/does/not/exist/file.txt'
fs.ensureSymlinkSync(srcPath, destPath)
// symlink has now been created, including the directory it is to be placed in