Skip to content

shinnn/lstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.