Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
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. ```