source: trip-planner-front/node_modules/memfs/lib/Dirent.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Dirent = void 0;
4var constants_1 = require("./constants");
5var encoding_1 = require("./encoding");
6var S_IFMT = constants_1.constants.S_IFMT, S_IFDIR = constants_1.constants.S_IFDIR, S_IFREG = constants_1.constants.S_IFREG, S_IFBLK = constants_1.constants.S_IFBLK, S_IFCHR = constants_1.constants.S_IFCHR, S_IFLNK = constants_1.constants.S_IFLNK, S_IFIFO = constants_1.constants.S_IFIFO, S_IFSOCK = constants_1.constants.S_IFSOCK;
7/**
8 * A directory entry, like `fs.Dirent`.
9 */
10var Dirent = /** @class */ (function () {
11 function Dirent() {
12 this.name = '';
13 this.mode = 0;
14 }
15 Dirent.build = function (link, encoding) {
16 var dirent = new Dirent();
17 var mode = link.getNode().mode;
18 dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
19 dirent.mode = mode;
20 return dirent;
21 };
22 Dirent.prototype._checkModeProperty = function (property) {
23 return (this.mode & S_IFMT) === property;
24 };
25 Dirent.prototype.isDirectory = function () {
26 return this._checkModeProperty(S_IFDIR);
27 };
28 Dirent.prototype.isFile = function () {
29 return this._checkModeProperty(S_IFREG);
30 };
31 Dirent.prototype.isBlockDevice = function () {
32 return this._checkModeProperty(S_IFBLK);
33 };
34 Dirent.prototype.isCharacterDevice = function () {
35 return this._checkModeProperty(S_IFCHR);
36 };
37 Dirent.prototype.isSymbolicLink = function () {
38 return this._checkModeProperty(S_IFLNK);
39 };
40 Dirent.prototype.isFIFO = function () {
41 return this._checkModeProperty(S_IFIFO);
42 };
43 Dirent.prototype.isSocket = function () {
44 return this._checkModeProperty(S_IFSOCK);
45 };
46 return Dirent;
47}());
48exports.Dirent = Dirent;
49exports.default = Dirent;
Note: See TracBrowser for help on using the repository browser.