memfs 3.4.4 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/node.d.ts +1 -0
- package/lib/node.js +6 -6
- package/lib/promises.d.ts +1 -0
- package/lib/volume.d.ts +3 -0
- package/lib/volume.js +12 -10
- package/package.json +9 -9
package/lib/node.d.ts
CHANGED
package/lib/node.js
CHANGED
|
@@ -160,16 +160,16 @@ var Node = /** @class */ (function (_super) {
|
|
|
160
160
|
Node.prototype.canRead = function (uid, gid) {
|
|
161
161
|
if (uid === void 0) { uid = process_1.default.getuid(); }
|
|
162
162
|
if (gid === void 0) { gid = process_1.default.getgid(); }
|
|
163
|
-
if (this.perm & 4 /* IROTH */) {
|
|
163
|
+
if (this.perm & 4 /* S.IROTH */) {
|
|
164
164
|
return true;
|
|
165
165
|
}
|
|
166
166
|
if (gid === this.gid) {
|
|
167
|
-
if (this.perm & 32 /* IRGRP */) {
|
|
167
|
+
if (this.perm & 32 /* S.IRGRP */) {
|
|
168
168
|
return true;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
if (uid === this.uid) {
|
|
172
|
-
if (this.perm & 256 /* IRUSR */) {
|
|
172
|
+
if (this.perm & 256 /* S.IRUSR */) {
|
|
173
173
|
return true;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -178,16 +178,16 @@ var Node = /** @class */ (function (_super) {
|
|
|
178
178
|
Node.prototype.canWrite = function (uid, gid) {
|
|
179
179
|
if (uid === void 0) { uid = process_1.default.getuid(); }
|
|
180
180
|
if (gid === void 0) { gid = process_1.default.getgid(); }
|
|
181
|
-
if (this.perm & 2 /* IWOTH */) {
|
|
181
|
+
if (this.perm & 2 /* S.IWOTH */) {
|
|
182
182
|
return true;
|
|
183
183
|
}
|
|
184
184
|
if (gid === this.gid) {
|
|
185
|
-
if (this.perm & 16 /* IWGRP */) {
|
|
185
|
+
if (this.perm & 16 /* S.IWGRP */) {
|
|
186
186
|
return true;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
if (uid === this.uid) {
|
|
190
|
-
if (this.perm & 128 /* IWUSR */) {
|
|
190
|
+
if (this.perm & 128 /* S.IWUSR */) {
|
|
191
191
|
return true;
|
|
192
192
|
}
|
|
193
193
|
}
|
package/lib/promises.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Volume, TData, TMode, TFlags, TFlagsCopy, TTime, IOptions, IAppendFileOptions, IMkdirOptions, IReaddirOptions, IReadFileOptions, IRealpathOptions, IWriteFileOptions, IStatOptions, IRmOptions, IFStatOptions } from './volume';
|
|
3
4
|
import Stats from './Stats';
|
|
4
5
|
import Dirent from './Dirent';
|
package/lib/volume.d.ts
CHANGED
package/lib/volume.js
CHANGED
|
@@ -222,13 +222,13 @@ var readFileOptsDefaults = {
|
|
|
222
222
|
var getReadFileOptions = optsGenerator(readFileOptsDefaults);
|
|
223
223
|
var writeFileDefaults = {
|
|
224
224
|
encoding: 'utf8',
|
|
225
|
-
mode: 438 /* DEFAULT */,
|
|
225
|
+
mode: 438 /* MODE.DEFAULT */,
|
|
226
226
|
flag: FLAGS[FLAGS.w],
|
|
227
227
|
};
|
|
228
228
|
var getWriteFileOptions = optsGenerator(writeFileDefaults);
|
|
229
229
|
var appendFileDefaults = {
|
|
230
230
|
encoding: 'utf8',
|
|
231
|
-
mode: 438 /* DEFAULT */,
|
|
231
|
+
mode: 438 /* MODE.DEFAULT */,
|
|
232
232
|
flag: FLAGS[FLAGS.a],
|
|
233
233
|
};
|
|
234
234
|
var getAppendFileOpts = optsGenerator(appendFileDefaults);
|
|
@@ -237,7 +237,7 @@ var realpathDefaults = optsDefaults;
|
|
|
237
237
|
var getRealpathOptions = optsGenerator(realpathDefaults);
|
|
238
238
|
var getRealpathOptsAndCb = optsAndCbGenerator(getRealpathOptions);
|
|
239
239
|
var mkdirDefaults = {
|
|
240
|
-
mode: 511 /* DIR */,
|
|
240
|
+
mode: 511 /* MODE.DIR */,
|
|
241
241
|
recursive: false,
|
|
242
242
|
};
|
|
243
243
|
var getMkdirOptions = function (options) {
|
|
@@ -770,11 +770,11 @@ var Volume = /** @class */ (function () {
|
|
|
770
770
|
filename = resolve(filename, cwd);
|
|
771
771
|
if (typeof data === 'string') {
|
|
772
772
|
var dir = dirname(filename);
|
|
773
|
-
this.mkdirpBase(dir, 511 /* DIR */);
|
|
773
|
+
this.mkdirpBase(dir, 511 /* MODE.DIR */);
|
|
774
774
|
this.writeFileSync(filename, data);
|
|
775
775
|
}
|
|
776
776
|
else {
|
|
777
|
-
this.mkdirpBase(filename, 511 /* DIR */);
|
|
777
|
+
this.mkdirpBase(filename, 511 /* MODE.DIR */);
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
780
|
};
|
|
@@ -836,6 +836,8 @@ var Volume = /** @class */ (function () {
|
|
|
836
836
|
if (resolveSymlinks === void 0) { resolveSymlinks = true; }
|
|
837
837
|
var steps = filenameToSteps(filename);
|
|
838
838
|
var link = resolveSymlinks ? this.getResolvedLink(steps) : this.getLink(steps);
|
|
839
|
+
if (link && flagsNum & O_EXCL)
|
|
840
|
+
throw createError(EEXIST, 'open', filename);
|
|
839
841
|
// Try creating a new file, if it does not exist.
|
|
840
842
|
if (!link && flagsNum & O_CREAT) {
|
|
841
843
|
// const dirLink: Link = this.getLinkParent(steps);
|
|
@@ -859,7 +861,7 @@ var Volume = /** @class */ (function () {
|
|
|
859
861
|
return file.fd;
|
|
860
862
|
};
|
|
861
863
|
Volume.prototype.openSync = function (path, flags, mode) {
|
|
862
|
-
if (mode === void 0) { mode = 438 /* DEFAULT */; }
|
|
864
|
+
if (mode === void 0) { mode = 438 /* MODE.DEFAULT */; }
|
|
863
865
|
// Validate (1) mode; (2) path; (3) flags - in that order.
|
|
864
866
|
var modeNum = modeToNumber(mode);
|
|
865
867
|
var fileName = pathToFilename(path);
|
|
@@ -870,10 +872,10 @@ var Volume = /** @class */ (function () {
|
|
|
870
872
|
var mode = a;
|
|
871
873
|
var callback = b;
|
|
872
874
|
if (typeof a === 'function') {
|
|
873
|
-
mode = 438 /* DEFAULT */;
|
|
875
|
+
mode = 438 /* MODE.DEFAULT */;
|
|
874
876
|
callback = a;
|
|
875
877
|
}
|
|
876
|
-
mode = mode || 438 /* DEFAULT */;
|
|
878
|
+
mode = mode || 438 /* MODE.DEFAULT */;
|
|
877
879
|
var modeNum = modeToNumber(mode);
|
|
878
880
|
var fileName = pathToFilename(path);
|
|
879
881
|
var flagsNum = flagsToNumber(flags);
|
|
@@ -1153,7 +1155,7 @@ var Volume = /** @class */ (function () {
|
|
|
1153
1155
|
if (flags & COPYFILE_FICLONE_FORCE) {
|
|
1154
1156
|
throw createError(ENOSYS, 'copyFile', src, dest);
|
|
1155
1157
|
}
|
|
1156
|
-
this.writeFileBase(dest, buf, FLAGS.w, 438 /* DEFAULT */);
|
|
1158
|
+
this.writeFileBase(dest, buf, FLAGS.w, 438 /* MODE.DEFAULT */);
|
|
1157
1159
|
};
|
|
1158
1160
|
Volume.prototype.copyFileSync = function (src, dest, flags) {
|
|
1159
1161
|
var srcFilename = pathToFilename(src);
|
|
@@ -1616,7 +1618,7 @@ var Volume = /** @class */ (function () {
|
|
|
1616
1618
|
if (retry === void 0) { retry = 5; }
|
|
1617
1619
|
var filename = prefix + this.genRndStr();
|
|
1618
1620
|
try {
|
|
1619
|
-
this.mkdirBase(filename, 511 /* DIR */);
|
|
1621
|
+
this.mkdirBase(filename, 511 /* MODE.DIR */);
|
|
1620
1622
|
return (0, encoding_1.strToEncoding)(filename, encoding);
|
|
1621
1623
|
}
|
|
1622
1624
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memfs",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "In-memory file-system with Node's fs API.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"@semantic-release/changelog": "6.0.1",
|
|
30
30
|
"@semantic-release/git": "10.0.1",
|
|
31
31
|
"@semantic-release/npm": "9.0.1",
|
|
32
|
-
"@types/jest": "27.5.
|
|
32
|
+
"@types/jest": "27.5.2",
|
|
33
33
|
"@types/node": "10.17.60",
|
|
34
|
-
"husky": "
|
|
35
|
-
"jest": "28.
|
|
36
|
-
"prettier": "2.
|
|
34
|
+
"husky": "8.0.1",
|
|
35
|
+
"jest": "28.1.1",
|
|
36
|
+
"prettier": "2.7.1",
|
|
37
37
|
"pretty-quick": "3.1.3",
|
|
38
38
|
"rimraf": "3.0.2",
|
|
39
|
-
"semantic-release": "19.0.
|
|
40
|
-
"ts-jest": "28.0.
|
|
41
|
-
"ts-node": "10.
|
|
39
|
+
"semantic-release": "19.0.3",
|
|
40
|
+
"ts-jest": "28.0.5",
|
|
41
|
+
"ts-node": "10.8.1",
|
|
42
42
|
"tslint": "5.20.1",
|
|
43
43
|
"tslint-config-common": "1.6.0",
|
|
44
|
-
"typescript": "4.
|
|
44
|
+
"typescript": "4.7.4"
|
|
45
45
|
},
|
|
46
46
|
"config": {
|
|
47
47
|
"commitizen": {
|