lstat

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i lstat

Weekly Downloads

104

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn