.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @nodelib / fs.stat / README.md
1 # @nodelib/fs.stat
2
3 > Get the status of a file with some features.
4
5 ## :bulb: Highlights
6
7 Wrapper over standard methods ([`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback), [`fs.stat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_stat_path_callback)) with some features.
8
9   * :beginner: Normally follows symlinks.
10   * :gear: Can safely work with broken symlinks (returns information about symlink instead of generating an error).
11
12 ## Install
13
14 ```
15 $ npm install @nodelib/fs.stat
16 ```
17
18 ## Usage
19
20 ```js
21 const fsStat = require('@nodelib/fs.stat');
22
23 fsStat.stat('path').then((stat) => {
24     console.log(stat); // => fs.Stats
25 });
26 ```
27
28 ## API
29
30 ### fsStat.stat(path, [options])
31
32 Returns a [`Promise<fs.Stats>`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
33
34 ### fsStat.statSync(path, [options])
35
36 Returns a [`fs.Stats`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
37
38 ### fsStat.statCallback(path, [options], callback)
39
40 Returns a [`fs.Stats`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path with standard callback-style.
41
42 #### path
43
44   * Type: `string | Buffer | URL`
45
46 The `path` argument for [`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback) or [`fs.stat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_stat_path_callback) method.
47
48 #### options
49
50   * Type: `Object`
51
52 See [options](#options-1) section for more detailed information.
53
54 ## Options
55
56 ### throwErrorOnBrokenSymlinks
57
58   * Type: `boolean`
59   * Default: `true`
60
61 Throw an error or return information about symlink, when symlink is broken. When `false`, methods will be return lstat call for broken symlinks.
62
63 ### followSymlinks
64
65   * Type: `boolean`
66   * Default: `true`
67
68 By default, the methods of this package follows symlinks. If you do not want it, set this option to `false` or use the standard method [`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback).
69
70 ### fs
71
72   * Type: `FileSystemAdapter`
73   * Default: `built-in FS methods`
74
75 By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace each method with your own.
76
77 ```ts
78 interface FileSystemAdapter {
79         lstat?: typeof fs.lstat;
80         stat?: typeof fs.stat;
81         lstatSync?: typeof fs.lstatSync;
82         statSync?: typeof fs.statSync;
83 }
84 ```
85
86 ## Changelog
87
88 See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelogs for each release version.
89
90 ## License
91
92 This software is released under the terms of the MIT license.