Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/lstat
Promise-based `lstat`
https://github.com/shinnn/lstat
async file filesystem fs javascript lstat nodejs promise promisified promisify
Last synced: 27 days ago
JSON representation
Promise-based `lstat`
- Host: GitHub
- URL: https://github.com/shinnn/lstat
- Owner: shinnn
- License: mit
- Created: 2017-02-07T11:26:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-27T11:36:02.000Z (over 7 years ago)
- Last Synced: 2024-09-25T07:42:42.233Z (about 2 months ago)
- Topics: async, file, filesystem, fs, javascript, lstat, nodejs, promise, promisified, promisify
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lstat
[![NPM version](https://img.shields.io/npm/v/lstat.svg)](https://www.npmjs.com/package/lstat)
[![Build Status](https://travis-ci.org/shinnn/lstat.svg?branch=master)](https://travis-ci.org/shinnn/lstat)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/lstat.svg)](https://coveralls.io/github/shinnn/lstat?branch=master)[Promise](https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise)-based [`lstat`](http://man7.org/linux/man-pages/man2/lstat.2.html)
```javascript
const lstat = require('lstat');lstat('/path/to/file').then(stat => {
stat; //=> {dev: 16777220, mode: 33188, nlink: 1, uid: 501, gid: 20, ...}
});
```## Installation
[Use npm.](https://docs.npmjs.com/cli/install)
```
npm install lstat
```## API
```javascript
const lstat = require('lstat');
```### lstat(*path*)
*path*: `String`
Return: `Promise`Almost the same as the [Node.js](https://nodejs.org/) built-in [`fs.lstat`](https://nodejs.org/api/fs.html#fs_fs_lstat_path_callback), but:
* It returns [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise), instead of passing the result to its callback function.
* The first parameter does't accept `Buffer` by design. Just use `String` instead.```javascript
lstat('/path/to/directory').then(stat => {
stat.isDirectory(); //=> true
});lstat('/path/to/symlink').then(stat => {
stat.isSymbolicLink(); //=> true
});
```## License
Copyright (c) 2017 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).