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 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # @nodelib/fs.stat
  2. > Get the status of a file with some features.
  3. ## :bulb: Highlights
  4. Wrapper around standard method `fs.lstat` and `fs.stat` with some features.
  5. * :beginner: Normally follows symbolic link.
  6. * :gear: Can safely work with broken symbolic link.
  7. ## Install
  8. ```console
  9. npm install @nodelib/fs.stat
  10. ```
  11. ## Usage
  12. ```ts
  13. import * as fsStat from '@nodelib/fs.stat';
  14. fsStat.stat('path', (error, stats) => { /* … */ });
  15. ```
  16. ## API
  17. ### .stat(path, [optionsOrSettings], callback)
  18. Returns an instance of `fs.Stats` class for provided path with standard callback-style.
  19. ```ts
  20. fsStat.stat('path', (error, stats) => { /* … */ });
  21. fsStat.stat('path', {}, (error, stats) => { /* … */ });
  22. fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ });
  23. ```
  24. ### .statSync(path, [optionsOrSettings])
  25. Returns an instance of `fs.Stats` class for provided path.
  26. ```ts
  27. const stats = fsStat.stat('path');
  28. const stats = fsStat.stat('path', {});
  29. const stats = fsStat.stat('path', new fsStat.Settings());
  30. ```
  31. #### path
  32. * Required: `true`
  33. * Type: `string | Buffer | URL`
  34. A path to a file. If a URL is provided, it must use the `file:` protocol.
  35. #### optionsOrSettings
  36. * Required: `false`
  37. * Type: `Options | Settings`
  38. * Default: An instance of `Settings` class
  39. An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
  40. > :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
  41. ### Settings([options])
  42. A class of full settings of the package.
  43. ```ts
  44. const settings = new fsStat.Settings({ followSymbolicLink: false });
  45. const stats = fsStat.stat('path', settings);
  46. ```
  47. ## Options
  48. ### `followSymbolicLink`
  49. * Type: `boolean`
  50. * Default: `true`
  51. Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`.
  52. ### `markSymbolicLink`
  53. * Type: `boolean`
  54. * Default: `false`
  55. Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`).
  56. > :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link.
  57. ### `throwErrorOnBrokenSymbolicLink`
  58. * Type: `boolean`
  59. * Default: `true`
  60. Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
  61. ### `fs`
  62. * Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
  63. * Default: A default FS methods
  64. By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
  65. ```ts
  66. interface FileSystemAdapter {
  67. lstat?: typeof fs.lstat;
  68. stat?: typeof fs.stat;
  69. lstatSync?: typeof fs.lstatSync;
  70. statSync?: typeof fs.statSync;
  71. }
  72. const settings = new fsStat.Settings({
  73. fs: { lstat: fakeLstat }
  74. });
  75. ```
  76. ## Changelog
  77. See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
  78. ## License
  79. This software is released under the terms of the MIT license.