2.0.0-1 • Published 6 years ago

get-mode v2.0.0-1

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

get-mode

npm version Build Status Coverage Status

A Node.js module to get a file mode

const getMode = require('get-mode');

(async () => {
  const mode = getMode('index.js'); //=> 33188
  mode.toString(8); //=> '100644'
})();

Installation

Use npm.

npm install get-mode

API

const getMode = require('get-mode');

getMode(path , option)

path: string Buffer URL (file, directory or symbolic link path)
option: Object
Return: Promise<Integer>

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.

(async () => {
  (await getMode('./symlink-to-directory')).toString(8);
  //=> '120755'

  (await getMode('./symlink-to-directory', {followSymlinks: true})).toString(8);
  //=> '40755'
})();

License

ISC License © 2017 Shinnosuke Watanabe

2.0.0-1

6 years ago

2.0.0-0

6 years ago

1.0.1

6 years ago

1.0.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago