From 69ac9a5c49c693265df0d97264a4a8b5df4f6725 Mon Sep 17 00:00:00 2001 From: Navin Moorthy Date: Wed, 12 Jul 2023 12:54:06 +0530 Subject: [PATCH] =?UTF-8?q?docs(ensureDirectoryAccess):=20=F0=9F=93=9D=20u?= =?UTF-8?q?pdate=20JSDoc=20for=20ensureDirectoryAccess?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Provide more accurate and detailed information about its purpose and behavior. --- src/utils/ensureDirectoryAccess.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/utils/ensureDirectoryAccess.ts b/src/utils/ensureDirectoryAccess.ts index 8a3903f..2b2c1bc 100644 --- a/src/utils/ensureDirectoryAccess.ts +++ b/src/utils/ensureDirectoryAccess.ts @@ -7,17 +7,18 @@ import { throwError } from "./throwError.js"; * Checks if a directory exists and is readable and writable. If it doesn't exist, it creates it. If it exists but is not readable or writable, it makes it both. * @async * @function - * @param {string} directoryPath - The path of the directory to check. - * @returns {Promise} A promise that resolves to a void indicating whether the directory exists and is readable and writable. + * @param {string} directoryPath - The directory path to check. + * @returns {Promise} A promise that resolves to a void indicating whether the directory exists and is readable and writable. + * @throws {Error} If the directory does not exist or is not accessible. */ export async function ensureDirectoryAccess( - directoryPath: string, + directoryPath: string ): Promise { try { await fs.access( directoryPath, // eslint-disable-next-line no-bitwise - fsSync.constants.F_OK | fsSync.constants.W_OK | fsSync.constants.R_OK, + fsSync.constants.F_OK | fsSync.constants.W_OK | fsSync.constants.R_OK ); } catch { try { @@ -26,7 +27,7 @@ export async function ensureDirectoryAccess( } catch (error) { throwError( error, - `${directoryPath} does not exists / writable / readable in ensureDirectoryAccess function`, + `${directoryPath} does not exists / writable / readable in ensureDirectoryAccess function` ); } }