1.0.0 • Published 8 years ago

lstat v1.0.0

Weekly downloads
283
License
MIT
Repository
github
Last release
8 years ago

lstat

NPM version Build Status Coverage Status

Promise-based lstat

const lstat = require('lstat');

lstat('/path/to/file').then(stat => {
  stat; //=> {dev: 16777220, mode: 33188, nlink: 1, uid: 501, gid: 20, ...}
});

Installation

Use npm.

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 use String 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.