1.0.0 • Published 8 years ago
lstat v1.0.0
lstat
const lstat = require('lstat');
lstat('/path/to/file').then(stat => {
stat; //=> {dev: 16777220, mode: 33188, nlink: 1, uid: 501, gid: 20, ...}
});
Installation
npm install lstat
API
const lstat = require('lstat');
lstat(path)
path: String
Return: Promise<fs.Stats>
Almost the same as the Node.js built-in fs.lstat
, but:
- It returns
Promise
, instead of passing the result to its callback function. - The first parameter does't accept
Buffer
by design. Just useString
instead.
lstat('/path/to/directory').then(stat => {
stat.isDirectory(); //=> true
});
lstat('/path/to/symlink').then(stat => {
stat.isSymbolicLink(); //=> true
});
License
Copyright (c) 2017 Shinnosuke Watanabe
Licensed under the MIT License.