Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ensureSymlink.md 677 B

il y a 3 ans
123456789101112131415161718192021222324252627282930
  1. # ensureSymlink(srcpath, dstpath, [type, callback])
  2. Ensures that the symlink exists. If the directory structure does not exist, it is created.
  3. - `srcpath` `<String>`
  4. - `dstpath` `<String>`
  5. - `type` `<String>`
  6. - `callback` `<Function>`
  7. ## Example:
  8. ```js
  9. const fs = require('fs-extra')
  10. const srcpath = '/tmp/file.txt'
  11. const dstpath = '/tmp/this/path/does/not/exist/file.txt'
  12. fs.ensureSymlink(srcpath, dstpath, err => {
  13. console.log(err) // => null
  14. // symlink has now been created, including the directory it is to be placed in
  15. })
  16. // With Promises:
  17. fs.ensureSymlink(srcpath, dstpath)
  18. .then(() => {
  19. console.log('success!')
  20. })
  21. .catch(err => {
  22. console.error(err)
  23. })
  24. ```