UNPKG

cli-stash

Version:

CLI application to manage and work with Atlassian Stash. Work with your Stash project and repositories from Command lines.

38 lines (37 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileChecker = void 0; const fs = require("fs"); /** * Class to check all about files. If is Apex Class, Apex Trigger, Aura Component... or check if exists or is a File or Directorty */ class FileChecker { /** * Method to check if file or folder exists on the system * @param {string} fileOFolderPath path to check * * @returns {boolean} true if exists, false in otherwise */ static isExists(fileOFolderPath) { return fs.existsSync(fileOFolderPath); } /** * Method to check if the path is a Directory path (and exists) * @param {string} folderPath path to check * * @returns {boolean} true if is a directory, false in otherwise */ static isDirectory(folderPath) { return FileChecker.isExists(folderPath) && fs.statSync(folderPath).isDirectory(); } /** * Method to check if the path is a File path (and exists) * @param {string} filePath path to check * * @returns {boolean} true if is a file, false in otherwise */ static isFile(filePath) { return FileChecker.isExists(filePath) && fs.statSync(filePath).isFile(); } } exports.FileChecker = FileChecker;