"use strict";
/**
 * penguins-eggs
 * class: n8.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
class n8 {
    /**
     *
     * @param dirPath
     */
    static isDirectory(name) {
        // console.log (`isDirectory: ${name}`)
        const path = '/' + name;
        const isDirectory = node_fs_1.default.existsSync(path) && node_fs_1.default.lstatSync(path).isDirectory();
        // console.log(`path: ${path} isDirectory: ${isDirectory}`)
        return isDirectory;
    }
    static isFile(name) {
        // console.log (`isFile: ${name}`)
        const path = '/' + name;
        const isFile = node_fs_1.default.existsSync(path) && node_fs_1.default.lstatSync(path).isFile();
        // console.log(`path: ${path} isFile: ${isFile}`)
        return isFile;
    }
    static isSymbolicLink(name) {
        // console.log (`isSymbolicLink: ${name}`)
        const path = '/' + name;
        const isSymbolicLink = node_fs_1.default.existsSync(path) && node_fs_1.default.lstatSync(path).isSymbolicLink();
        // console.log(`path: ${path} isSymbolicLink: ${isSymbolicLink}`)
        return isSymbolicLink;
    }
    static dirent2string(dir) {
        // const util = require('util')
        // console.log(util.inspect(dir, false, null, true /* enable colors */))
        let dirname = '';
        dirname = process.versions.node.split('.')[0] === '8' ? JSON.stringify(dir).replace('"', '').replace('"', '') : dir.name;
        return dirname;
    }
}
exports.default = n8;
