ensureSymlinkSync(srcpath, dstpath, [type])

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

  • srcpath <String>
  • dstpath <String>
  • type <String>

Example:

  1. const fs = require('fs-extra')
  2. const srcpath = '/tmp/file.txt'
  3. const dstpath = '/tmp/this/path/does/not/exist/file.txt'
  4. fs.ensureSymlinkSync(srcpath, dstpath)
  5. // symlink has now been created, including the directory it is to be placed in