website/node_modules/@nodelib/fs.stat/README.md

@nodelib/fs.stat

Get the status of a file with some features.

:bulb: Highlights

Wrapper over standard methods (fs.lstat, fs.stat) with some features.

Install

$ npm install @nodelib/fs.stat

Usage

const fsStat = require('@nodelib/fs.stat');

fsStat.stat('path').then((stat) => {
    console.log(stat); // => fs.Stats
});

API

fsStat.stat(path, [options])

Returns a Promise<fs.Stats> for provided path.

fsStat.statSync(path, [options])

Returns a fs.Stats for provided path.

fsStat.statCallback(path, [options], callback)

Returns a fs.Stats for provided path with standard callback-style.

path

The path argument for fs.lstat or fs.stat method.

options

See options section for more detailed information.

Options

throwErrorOnBrokenSymlinks

Throw an error or return information about symlink, when symlink is broken. When false, methods will be return lstat call for broken symlinks.

followSymlinks

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.

fs

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.

interface FileSystemAdapter {
    lstat?: typeof fs.lstat;
    stat?: typeof fs.stat;
    lstatSync?: typeof fs.lstatSync;
    statSync?: typeof fs.statSync;
}

Changelog

See the Releases section of our GitHub project for changelogs for each release version.

License

This software is released under the terms of the MIT license.



JohnCoene/chirp documentation built on May 25, 2021, 6:33 p.m.