Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path)
  2. > Get the first path that exists on disk of multiple paths
  3. ## Install
  4. ```
  5. $ npm install locate-path
  6. ```
  7. ## Usage
  8. Here we find the first file that exists on disk, in array order.
  9. ```js
  10. const locatePath = require('locate-path');
  11. const files = [
  12. 'unicorn.png',
  13. 'rainbow.png', // Only this one actually exists on disk
  14. 'pony.png'
  15. ];
  16. (async () => {
  17. console(await locatePath(files));
  18. //=> 'rainbow'
  19. })();
  20. ```
  21. ## API
  22. ### locatePath(paths, [options])
  23. Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
  24. #### paths
  25. Type: `Iterable<string>`
  26. Paths to check.
  27. #### options
  28. Type: `Object`
  29. ##### concurrency
  30. Type: `number`<br>
  31. Default: `Infinity`<br>
  32. Minimum: `1`
  33. Number of concurrently pending promises.
  34. ##### preserveOrder
  35. Type: `boolean`<br>
  36. Default: `true`
  37. Preserve `paths` order when searching.
  38. Disable this to improve performance if you don't care about the order.
  39. ##### cwd
  40. Type: `string`<br>
  41. Default: `process.cwd()`
  42. Current working directory.
  43. ##### type
  44. Type: `string`<br>
  45. Default: `file`<br>
  46. Values: `file` `directory`
  47. The type of paths that can match.
  48. ##### allowSymlinks
  49. Type: `boolean`<br>
  50. Default: `true`
  51. Allow symbolic links to match if they point to the chosen path type.
  52. ### locatePath.sync(paths, [options])
  53. Returns the first path that exists or `undefined` if none exists.
  54. #### paths
  55. Type: `Iterable<string>`
  56. Paths to check.
  57. #### options
  58. Type: `Object`
  59. ##### cwd
  60. Same as above.
  61. ##### type
  62. Same as above.
  63. ##### allowSymlinks
  64. Same as above.
  65. ## Related
  66. - [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
  67. ## License
  68. MIT © [Sindre Sorhus](https://sindresorhus.com)