A TypeScript module to determine whether the file is executable.
- Bun ^ v1.0.0
- Deno >= v1.34.0 / >= v1.41.1 (Via JSR)
🛡️ Require Permission
- Environment (
allow-env
)PATHEXT
(For Windows Only)
- File System - Read (
allow-read
) - System Info (
allow-sys
)gid
(For Non-Windows Only)uid
(For Non-Windows Only)
- Environment (
- NodeJS >= v16.13.0
🎯 Supported Target
- Deno
- Import at the script (
<ScriptName>.ts
):- Via DenoPKG
import ... from "https://denopkg.com/hugoalh-studio/is-executable-ts[@<Tag>]/mod.ts";
- Via GitHub Raw (Require Tag)
import ... from "https://raw.githubusercontent.com/hugoalh-studio/is-executable-ts/<Tag>/mod.ts";
- Via Pax
import ... from "https://pax.deno.dev/hugoalh-studio/is-executable-ts[@<Tag>]/mod.ts";
ℹ️ Note
Although it is recommended to import the entire module with the main path
mod.ts
, it is also able to import part of the module with sub path if available, but do not import if:- it's file path has an underscore prefix (e.g.:
_foo.ts
,_util/bar.ts
), or - it is a benchmark or test file (e.g.:
foo.bench.ts
,foo.test.ts
), or - it's symbol has an underscore prefix (e.g.:
export function _baz() {}
).
These elements are not considered part of the public API, thus no stability is guaranteed for them.
- Via DenoPKG
🎯 Supported Target
- Deno
- Import at the script (
<ScriptName>.ts
):import ... from "jsr:@hugoalh/is-executable[@<Tag>]";
ℹ️ Note
Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit file
jsr.jsonc
propertyexports
for available sub paths.
🎯 Supported Target
- Bun
- NodeJS
- Install via console/shell/terminal:
- Via Bun
bunx jsr add @hugoalh/is-executable[@<Tag>]
- Via NPM
npx jsr add @hugoalh/is-executable[@<Tag>]
- Via PNPM
pnpm dlx jsr add @hugoalh/is-executable[@<Tag>]
- Via Yarn
yarn dlx jsr add @hugoalh/is-executable[@<Tag>]
- Via Bun
- Import at the script (
<ScriptName>.ts
):import ... from "@hugoalh/is-executable";
ℹ️ Note
Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit file
jsr.jsonc
propertyexports
for available sub paths.
-
function isExecutable(filePath: string, options: IsExecutableOptions = {}): Promise<boolean>;
-
interface IsExecutableOptions { /** * If the file is not exist, whether to return `false` instead of throw an error. * @default false */ mayNotExist?: boolean; /** * Effective group ID to check executable mode flags on POSIX system. Default to the group ID of the current process. */ gid?: number; /** * Effective user ID to check executable mode flags on POSIX system. Default to the user ID of the current process. */ uid?: number; }
ℹ️ Note
For the prettier documentation, can visit via: