ensureLinkSync(srcpath, dstpath)

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

  • srcpath <String>
  • dstpath <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.ensureLinkSync(srcpath, dstpath)
  5. // link has now been created, including the directory it is to be placed in