Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/get-mode
Get a file mode
https://github.com/shinnn/get-mode
async filesystem javascript nodejs permission promise stats
Last synced: 27 days ago
JSON representation
Get a file mode
- Host: GitHub
- URL: https://github.com/shinnn/get-mode
- Owner: shinnn
- License: isc
- Created: 2017-03-07T09:33:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-04T04:27:48.000Z (over 6 years ago)
- Last Synced: 2024-09-15T05:48:46.808Z (2 months ago)
- Topics: async, filesystem, javascript, nodejs, permission, promise, stats
- Language: JavaScript
- Size: 131 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# get-mode
[![npm version](https://img.shields.io/npm/v/get-mode.svg)](https://www.npmjs.com/package/get-mode)
[![Build Status](https://travis-ci.org/shinnn/get-mode.svg?branch=master)](https://travis-ci.org/shinnn/get-mode)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/get-mode.svg)](https://coveralls.io/github/shinnn/get-mode?branch=master)A [Node.js](https://nodejs.org/) module to get a file mode
```javascript
const getMode = require('get-mode');(async () => {
const mode = getMode('index.js'); //=> 33188
mode.toString(8); //=> '100644'
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install get-mode
```## API
```javascript
const getMode = require('get-mode');
```### getMode(*path* [, *option*])
*path*: `string` `Buffer` `URL` (file, directory or symbolic link path)
*option*: `Object`
Return: `Promise`#### option.followSymlinks
Type: `boolean`
Default: `false`Whether to resolve all symbolic links before checking the mode, or get the mode of the symbolic link file itself.
```javascript
(async () => {
(await getMode('./symlink-to-directory')).toString(8);
//=> '120755'(await getMode('./symlink-to-directory', {followSymlinks: true})).toString(8);
//=> '40755'
})();
```## License
[ISC License](./LICENSE) © 2017 Shinnosuke Watanabe