UNPKG

@ovotech/genesys-web-messaging-tester-cli

Version:
21 lines (20 loc) 760 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.readableFileValidator = void 0; const fs_1 = __importDefault(require("fs")); const commander_1 = __importDefault(require("commander")); function readableFileValidator(fsAccessSync) { return function (filePath) { try { fsAccessSync(filePath, fs_1.default.constants.R_OK); } catch (error) { throw new commander_1.default.InvalidOptionArgumentError(`File '${filePath}' is not readable`); } return filePath; }; } exports.readableFileValidator = readableFileValidator;