New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-mode

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-mode

Get a file mode

latest
Source
npmnpm
Version
2.0.0-1
Version published
Maintainers
1
Created
Source

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>

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

Keywords

mode

FAQs

Package last updated on 01 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts