Comparing version 4.15.2 to 4.15.3
@@ -16,7 +16,6 @@ import { Volume } from './volume'; | ||
buf: Buffer; | ||
private _perm; | ||
mode: number; | ||
private _nlink; | ||
symlink: string; | ||
constructor(ino: number, perm?: number); | ||
constructor(ino: number, mode?: number); | ||
set ctime(ctime: Date); | ||
@@ -32,4 +31,4 @@ get ctime(): Date; | ||
get mtime(): Date; | ||
get perm(): number; | ||
set perm(perm: number); | ||
get perm(): number; | ||
set nlink(nlink: number); | ||
@@ -43,8 +42,6 @@ get nlink(): number; | ||
setModeProperty(property: number): void; | ||
setIsFile(): void; | ||
setIsDirectory(): void; | ||
setIsSymlink(): void; | ||
isFile(): boolean; | ||
isDirectory(): boolean; | ||
isSymlink(): boolean; | ||
isCharacterDevice(): boolean; | ||
makeSymlink(symlink: string): void; | ||
@@ -51,0 +48,0 @@ write(buf: Buffer, off?: number, len?: number, pos?: number): number; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const Stats_1 = require("./Stats"); | ||
const { S_IFMT, S_IFDIR, S_IFREG, S_IFLNK, O_APPEND } = constants_1.constants; | ||
const { S_IFMT, S_IFDIR, S_IFREG, S_IFLNK, S_IFCHR, O_APPEND } = constants_1.constants; | ||
const getuid = () => { var _a, _b; return (_b = (_a = process_1.default.getuid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }; | ||
@@ -18,3 +18,3 @@ const getgid = () => { var _a, _b; return (_b = (_a = process_1.default.getgid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }; | ||
class Node extends events_1.EventEmitter { | ||
constructor(ino, perm = 0o666) { | ||
constructor(ino, mode = 0o666) { | ||
super(); | ||
@@ -27,8 +27,5 @@ // User ID and group ID. | ||
this._ctime = new Date(); | ||
this._perm = 0o666; // Permissions `chmod`, `fchmod` | ||
this.mode = S_IFREG; // S_IFDIR, S_IFREG, etc.. (file by default?) | ||
// Number of hard links pointing at this Node. | ||
this._nlink = 1; | ||
this._perm = perm; | ||
this.mode |= perm; | ||
this.mode = mode; | ||
this.ino = ino; | ||
@@ -70,9 +67,9 @@ } | ||
} | ||
get perm() { | ||
return this.mode & ~S_IFMT; | ||
} | ||
set perm(perm) { | ||
this._perm = perm; | ||
this.mode = (this.mode & S_IFMT) | (perm & ~S_IFMT); | ||
this.ctime = new Date(); | ||
} | ||
get perm() { | ||
return this._perm; | ||
} | ||
set nlink(nlink) { | ||
@@ -108,13 +105,4 @@ this._nlink = nlink; | ||
setModeProperty(property) { | ||
this.mode = (this.mode & ~S_IFMT) | property; | ||
this.mode = property; | ||
} | ||
setIsFile() { | ||
this.setModeProperty(S_IFREG); | ||
} | ||
setIsDirectory() { | ||
this.setModeProperty(S_IFDIR); | ||
} | ||
setIsSymlink() { | ||
this.setModeProperty(S_IFLNK); | ||
} | ||
isFile() { | ||
@@ -130,4 +118,7 @@ return (this.mode & S_IFMT) === S_IFREG; | ||
} | ||
isCharacterDevice() { | ||
return (this.mode & S_IFMT) === S_IFCHR; | ||
} | ||
makeSymlink(symlink) { | ||
this.mode = S_IFLNK; | ||
this.mode = S_IFLNK | 0o666; | ||
this.symlink = symlink; | ||
@@ -182,4 +173,3 @@ } | ||
chmod(perm) { | ||
this.perm = perm; | ||
this.mode = (this.mode & ~0o777) | perm; | ||
this.mode = (this.mode & S_IFMT) | (perm & ~S_IFMT); | ||
this.touch(); | ||
@@ -302,3 +292,3 @@ } | ||
} | ||
createChild(name, node = this.vol.createNode()) { | ||
createChild(name, node = this.vol.createNode(S_IFREG | 0o666)) { | ||
const link = new Link(this.vol, this, name); | ||
@@ -305,0 +295,0 @@ link.setNode(node); |
@@ -86,7 +86,7 @@ import { Node, Link, File } from './node'; | ||
createLink(): Link; | ||
createLink(parent: Link, name: string, isDirectory?: boolean, perm?: number): Link; | ||
createLink(parent: Link, name: string, isDirectory?: boolean, mode?: number): Link; | ||
deleteLink(link: Link): boolean; | ||
private newInoNumber; | ||
private newFdNumber; | ||
createNode(isDirectory?: boolean, perm?: number): Node; | ||
createNode(mode: number): Node; | ||
private deleteNode; | ||
@@ -93,0 +93,0 @@ private walk; |
{ | ||
"name": "memfs", | ||
"version": "4.15.2", | ||
"version": "4.15.3", | ||
"description": "In-memory file-system with Node's fs API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
683239
10161