(filePath: string, permission: number = fs.constants.F_OK)
| 853 | * @param permission fs file access constants: https://nodejs.org/api/fs.html#file-access-constants |
| 854 | */ |
| 855 | export function pathAccessible(filePath: string, permission: number = fs.constants.F_OK): Promise<boolean> { |
| 856 | if (!filePath) { return Promise.resolve(false); } |
| 857 | return new Promise(resolve => fs.access(filePath, permission, err => resolve(!err))); |
| 858 | } |
| 859 | |
| 860 | export function isExecutable(file: string): Promise<boolean> { |
| 861 | return pathAccessible(file, fs.constants.X_OK); |
no test coverage detected