3 > Get the status of a file with some features.
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.
9 * :beginner: Normally follows symlinks.
10 * :gear: Can safely work with broken symlinks (returns information about symlink instead of generating an error).
15 $ npm install @nodelib/fs.stat
21 const fsStat = require('@nodelib/fs.stat');
23 fsStat.stat('path').then((stat) => {
24 console.log(stat); // => fs.Stats
30 ### fsStat.stat(path, [options])
32 Returns a [`Promise<fs.Stats>`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
34 ### fsStat.statSync(path, [options])
36 Returns a [`fs.Stats`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
38 ### fsStat.statCallback(path, [options], callback)
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.
44 * Type: `string | Buffer | URL`
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.
52 See [options](#options-1) section for more detailed information.
56 ### throwErrorOnBrokenSymlinks
61 Throw an error or return information about symlink, when symlink is broken. When `false`, methods will be return lstat call for broken symlinks.
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).
72 * Type: `FileSystemAdapter`
73 * Default: `built-in FS methods`
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.
78 interface FileSystemAdapter {
79 lstat?: typeof fs.lstat;
80 stat?: typeof fs.stat;
81 lstatSync?: typeof fs.lstatSync;
82 statSync?: typeof fs.statSync;
88 See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelogs for each release version.
92 This software is released under the terms of the MIT license.