From 54127916e9778a45f98aaa9adf3c45213b1f0e9d Mon Sep 17 00:00:00 2001 From: Daniel Imhoff Date: Sun, 3 Mar 2019 14:04:35 -0600 Subject: [PATCH] feat(fs): add `pathReadable`, `pathWritable`, and `pathExecutable` --- packages/@ionic/utils-fs/src/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/@ionic/utils-fs/src/index.ts b/packages/@ionic/utils-fs/src/index.ts index b9c34ee70e..f81f2091fa 100644 --- a/packages/@ionic/utils-fs/src/index.ts +++ b/packages/@ionic/utils-fs/src/index.ts @@ -245,6 +245,18 @@ export async function pathExists(filePath: string): Promise { return pathAccessible(filePath, fs.constants.F_OK); } +export async function pathReadable(filePath: string): Promise { + return pathAccessible(filePath, fs.constants.R_OK); +} + +export async function pathWritable(filePath: string): Promise { + return pathAccessible(filePath, fs.constants.W_OK); +} + +export async function pathExecutable(filePath: string): Promise { + return pathAccessible(filePath, fs.constants.X_OK); +} + /** * Find the base directory based on the path given and a marker file to look for. */