Debian Codegraph @

nodelib-fs-macchiato/out/stats.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 const uid = process.platform === 'win32' ? undefined : process.getuid();
4 const gid = process.platform === 'win32' ? undefined : process.getgid();
5 class Stats {
6 constructor(_options = {}) {
7 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8 this._options = _options;
9 this._date = new Date();
10 this.dev = (_a = this._options.dev) !== null && _a !== void 0 ? _a : 0;
11 this.ino = (_b = this._options.ino) !== null && _b !== void 0 ? _b : 0;
12 this.mode = (_c = this._options.mode) !== null && _c !== void 0 ? _c : 0;
13 this.nlink = (_d = this._options.nlink) !== null && _d !== void 0 ? _d : 0;
14 this.uid = ('uid' in this._options ? this._options.uid : uid);
15 this.gid = ('gid' in this._options ? this._options.gid : gid);
16 this.rdev = (_e = this._options.rdev) !== null && _e !== void 0 ? _e : 0;
17 this.size = (_f = this._options.size) !== null && _f !== void 0 ? _f : 0;
18 this.blksize = (_g = this._options.blksize) !== null && _g !== void 0 ? _g : 0;
19 this.blocks = (_h = this._options.blocks) !== null && _h !== void 0 ? _h : 0;
20 this.atimeMs = (_j = this._options.atimeMs) !== null && _j !== void 0 ? _j : this._date.getTime();
21 this.mtimeMs = (_k = this._options.mtimeMs) !== null && _k !== void 0 ? _k : this._date.getTime();
22 this.ctimeMs = (_l = this._options.ctimeMs) !== null && _l !== void 0 ? _l : this._date.getTime();
23 this.birthtimeMs = (_m = this._options.birthtimeMs) !== null && _m !== void 0 ? _m : this._date.getTime();
24 this.atime = (_o = this._options.atime) !== null && _o !== void 0 ? _o : this._date;
25 this.mtime = (_p = this._options.mtime) !== null && _p !== void 0 ? _p : this._date;
26 this.ctime = (_q = this._options.ctime) !== null && _q !== void 0 ? _q : this._date;
27 this.birthtime = (_r = this._options.birthtime) !== null && _r !== void 0 ? _r : this._date;
28 }
29 isFile() {
30 var _a;
31 return (_a = this._options.isFile) !== null && _a !== void 0 ? _a : true;
32 }
33 isDirectory() {
34 var _a;
35 return (_a = this._options.isDirectory) !== null && _a !== void 0 ? _a : false;
36 }
37 isBlockDevice() {
38 var _a;
39 return (_a = this._options.isBlockDevice) !== null && _a !== void 0 ? _a : false;
40 }
41 isCharacterDevice() {
42 var _a;
43 return (_a = this._options.isCharacterDevice) !== null && _a !== void 0 ? _a : false;
44 }
45 isSymbolicLink() {
46 var _a;
47 return (_a = this._options.isSymbolicLink) !== null && _a !== void 0 ? _a : false;
48 }
49 isFIFO() {
50 var _a;
51 return (_a = this._options.isFIFO) !== null && _a !== void 0 ? _a : false;
52 }
53 isSocket() {
54 var _a;
55 return (_a = this._options.isSocket) !== null && _a !== void 0 ? _a : false;
56 }
57 }
58 exports.default = Stats;