function directoryExistsSync(inputPath, required) {
    if (!inputPath) {
        throw new Error("Arg 'path' must not be empty");
    }
    let stats;
    try {
        stats = fs.statSync(inputPath);
    }
    catch (error) {
        if (error.code === 'ENOENT') {
            if (!required) {
                return false;
            }
            throw new Error(`Directory '${inputPath}' does not exist`);
        }
        throw new Error(`Encountered an error when checking whether path '${inputPath}' exists: ${error.message}`);
    }
    if (stats.isDirectory()) {
        return true;
    }
    else if (!required) {
        return false;
    }
    throw new Error(`Directory '${inputPath}' does not exist`);
}
/**
 * Checks if a given directory exists
 */
Checks if a given directory exists
Checks if a given directory exists
function directoryExistsSync(inputPath, required) {
    if (!inputPath) {
        throw new Error("Arg 'path' must not be empty");
    }
    let stats;
    try {
        stats = fs.statSync(inputPath);
    }
    catch (error) {
        if (error.code === 'ENOENT') {
            if (!required) {
                return false;
            }
            throw new Error(`Directory '${inputPath}' does not exist`);
        }
        throw new Error(`Encountered an error when checking whether path '${inputPath}' exists: ${error.message}`);
    }
    if (stats.isDirectory()) {
        return true;
    }
    else if (!required) {
        return false;
    }
    throw new Error(`Directory '${inputPath}' does not exist`);
}
function directoryExistsSync ( inputPath , required ) { if ( ! inputPath ) { throw new Error ( "Arg 'path' must not be empty" ) ; } let stats ; try { stats = fs . statSync ( inputPath ) ; } catch ( error ) { if ( error . code === 'ENOENT' ) { if ( ! required ) { return false ; } throw new Error ( ` ${ inputPath } ` ) ; } throw new Error ( ` ${ inputPath } ${ error . message } ` ) ; } if ( stats . isDirectory ( ) ) { return true ; } else if ( ! required ) { return false ; } throw new Error ( ` ${ inputPath } ` ) ; }
Checks if a given directory exists
Checks if a given directory exists