@kp-mods/fs.macchiato
Version:
A set of classes for easy testing of built-in structures of FS
25 lines (24 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dirent = exports.DirentType = void 0;
const fs = require("node:fs");
// https://github.com/nodejs/node/blob/6675505686310771b8016805a381945826aad887/typings/internalBinding/constants.d.ts#L139-L146
var DirentType;
(function (DirentType) {
DirentType[DirentType["Unknown"] = 0] = "Unknown";
DirentType[DirentType["File"] = 1] = "File";
DirentType[DirentType["Directory"] = 2] = "Directory";
DirentType[DirentType["Link"] = 3] = "Link";
DirentType[DirentType["Fifo"] = 4] = "Fifo";
DirentType[DirentType["Socket"] = 5] = "Socket";
DirentType[DirentType["Char"] = 6] = "Char";
DirentType[DirentType["Block"] = 7] = "Block";
})(DirentType || (exports.DirentType = DirentType = {}));
class Dirent extends fs.Dirent {
constructor(name = 'unknown.txt', type = DirentType.Unknown) {
// @ts-expect-error Types do not provide arguments.
// https://github.com/nodejs/node/blob/6675505686310771b8016805a381945826aad887/lib/internal/fs/utils.js#L164
super(name, type);
}
}
exports.Dirent = Dirent;