pwd-fs 2.3.0 → 2.4.2
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/.travis.yml +3 -0
- package/appveyor.yml +3 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +0 -2
- package/lib/src/recurse-io-sync.js +0 -1
- package/lib/src/recurse-io.js +0 -1
- package/lib/test/append.spec.js +7 -8
- package/lib/test/bitmask.spec.js +10 -11
- package/lib/test/chmod.spec.js +9 -10
- package/lib/test/chown.spec.js +9 -10
- package/lib/test/constructor.spec.js +3 -4
- package/lib/test/copy.spec.js +12 -13
- package/lib/test/mkdir.spec.js +13 -14
- package/lib/test/read.spec.js +10 -11
- package/lib/test/readdir.spec.js +5 -6
- package/lib/test/remove.spec.js +7 -8
- package/lib/test/rename.spec.js +9 -10
- package/lib/test/stat.spec.js +11 -12
- package/lib/test/symlink.spec.js +11 -12
- package/lib/test/test.spec.js +10 -11
- package/lib/test/write.spec.js +12 -13
- package/package.json +2 -3
- package/readme.md +7 -6
- package/src/index.ts +0 -2
- package/tsconfig.json +2 -1
package/.travis.yml
CHANGED
package/appveyor.yml
CHANGED
package/lib/src/index.d.ts
CHANGED
package/lib/src/index.js
CHANGED
|
@@ -200,7 +200,6 @@ class PoweredFileSystem {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
append(src, data, { sync = false, resolve = true, encoding = 'utf8', umask = 0o000, flag = 'a' } = {}) {
|
|
203
|
-
console.log(`'append' with be removed in the next major version. Use 'write' with { flag: 'a' } option`);
|
|
204
203
|
if (resolve) {
|
|
205
204
|
src = this.resolve(src);
|
|
206
205
|
}
|
|
@@ -296,4 +295,3 @@ class PoweredFileSystem {
|
|
|
296
295
|
}
|
|
297
296
|
exports.default = PoweredFileSystem;
|
|
298
297
|
module.exports = PoweredFileSystem;
|
|
299
|
-
//# sourceMappingURL=index.js.map
|
package/lib/src/recurse-io.js
CHANGED
package/lib/test/append.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('append(src, data [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,7 +29,7 @@ describe('append(src, data [, options])', () => {
|
|
|
29
29
|
const payload = chance.string();
|
|
30
30
|
await pfs.append('./tmpdir/binapp', payload);
|
|
31
31
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
32
|
-
assert_1.default(after.size > before.size);
|
|
32
|
+
(0, assert_1.default)(after.size > before.size);
|
|
33
33
|
});
|
|
34
34
|
it('Positive: Must append content to file when path is absolute', async () => {
|
|
35
35
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('append(src, data [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
44
|
-
assert_1.default(after.size > before.size);
|
|
44
|
+
(0, assert_1.default)(after.size > before.size);
|
|
45
45
|
});
|
|
46
46
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -53,7 +53,7 @@ describe('append(src, data [, options])', () => {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
assert_1.default(err.errno === -9);
|
|
56
|
+
(0, assert_1.default)(err.errno === -9);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
describe('sync mode', () => {
|
|
@@ -66,7 +66,7 @@ describe('append(src, data [, options])', () => {
|
|
|
66
66
|
sync: true
|
|
67
67
|
});
|
|
68
68
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
69
|
-
assert_1.default(after.size > before.size);
|
|
69
|
+
(0, assert_1.default)(after.size > before.size);
|
|
70
70
|
});
|
|
71
71
|
it('Positive: Must append content to file when path is absolute', async () => {
|
|
72
72
|
const pfs = new src_1.default();
|
|
@@ -79,7 +79,7 @@ describe('append(src, data [, options])', () => {
|
|
|
79
79
|
resolve: false
|
|
80
80
|
});
|
|
81
81
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
82
|
-
assert_1.default(after.size > before.size);
|
|
82
|
+
(0, assert_1.default)(after.size > before.size);
|
|
83
83
|
});
|
|
84
84
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
85
85
|
const pfs = new src_1.default();
|
|
@@ -92,9 +92,8 @@ describe('append(src, data [, options])', () => {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
assert_1.default(err.errno === -9);
|
|
95
|
+
(0, assert_1.default)(err.errno === -9);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
//# sourceMappingURL=append.spec.js.map
|
package/lib/test/bitmask.spec.js
CHANGED
|
@@ -7,15 +7,15 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
7
7
|
const src_1 = __importDefault(require("../src"));
|
|
8
8
|
describe('static bitmask(mode: number)', () => {
|
|
9
9
|
it('Positive: Calculate bitmask', () => {
|
|
10
|
-
assert_1.default(src_1.default.bitmask(33024) === 0o400); // (r--------)
|
|
11
|
-
assert_1.default(src_1.default.bitmask(33152) === 0o600); // (rw-------)
|
|
12
|
-
assert_1.default(src_1.default.bitmask(33216) === 0o700); // (rwx------)
|
|
13
|
-
assert_1.default(src_1.default.bitmask(32800) === 0o040); // (---r-----)
|
|
14
|
-
assert_1.default(src_1.default.bitmask(32816) === 0o060); // (---rw----)
|
|
15
|
-
assert_1.default(src_1.default.bitmask(32824) === 0o070); // (---rwx---)
|
|
16
|
-
assert_1.default(src_1.default.bitmask(32772) === 0o004); // (------r--)
|
|
17
|
-
assert_1.default(src_1.default.bitmask(32774) === 0o006); // (------rw-)
|
|
18
|
-
assert_1.default(src_1.default.bitmask(32775) === 0o007); // (------rwx)
|
|
10
|
+
(0, assert_1.default)(src_1.default.bitmask(33024) === 0o400); // (r--------)
|
|
11
|
+
(0, assert_1.default)(src_1.default.bitmask(33152) === 0o600); // (rw-------)
|
|
12
|
+
(0, assert_1.default)(src_1.default.bitmask(33216) === 0o700); // (rwx------)
|
|
13
|
+
(0, assert_1.default)(src_1.default.bitmask(32800) === 0o040); // (---r-----)
|
|
14
|
+
(0, assert_1.default)(src_1.default.bitmask(32816) === 0o060); // (---rw----)
|
|
15
|
+
(0, assert_1.default)(src_1.default.bitmask(32824) === 0o070); // (---rwx---)
|
|
16
|
+
(0, assert_1.default)(src_1.default.bitmask(32772) === 0o004); // (------r--)
|
|
17
|
+
(0, assert_1.default)(src_1.default.bitmask(32774) === 0o006); // (------rw-)
|
|
18
|
+
(0, assert_1.default)(src_1.default.bitmask(32775) === 0o007); // (------rwx)
|
|
19
19
|
});
|
|
20
20
|
it(`Negative: Throw an exception if the argument is 'null' type`, () => {
|
|
21
21
|
try {
|
|
@@ -23,8 +23,7 @@ describe('static bitmask(mode: number)', () => {
|
|
|
23
23
|
src_1.default.bitmask(null);
|
|
24
24
|
}
|
|
25
25
|
catch (err) {
|
|
26
|
-
assert_1.default(err);
|
|
26
|
+
(0, assert_1.default)(err);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
//# sourceMappingURL=bitmask.spec.js.map
|
package/lib/test/chmod.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('chmod(src, mode [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -27,7 +27,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
27
27
|
await pfs.chmod('./tmpdir', 0o744);
|
|
28
28
|
const { mode } = await pfs.stat('./tmpdir/binapp');
|
|
29
29
|
const umask = src_1.default.bitmask(mode);
|
|
30
|
-
assert_1.default(umask === 0o744);
|
|
30
|
+
(0, assert_1.default)(umask === 0o744);
|
|
31
31
|
});
|
|
32
32
|
it('Positive: Must be changes directory when path is absolute', async () => {
|
|
33
33
|
const pfs = new src_1.default();
|
|
@@ -37,7 +37,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
37
37
|
});
|
|
38
38
|
const { mode } = await pfs.stat('./tmpdir/libxbase');
|
|
39
39
|
const umask = src_1.default.bitmask(mode);
|
|
40
|
-
assert_1.default(umask === 0o744);
|
|
40
|
+
(0, assert_1.default)(umask === 0o744);
|
|
41
41
|
});
|
|
42
42
|
it('Negative: Search permission is denied on a component of the path prefix', async () => {
|
|
43
43
|
const pfs = new src_1.default();
|
|
@@ -45,7 +45,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
45
45
|
await pfs.chmod('./tmpdir', 0);
|
|
46
46
|
}
|
|
47
47
|
catch (err) {
|
|
48
|
-
assert_1.default(err.errno === -9);
|
|
48
|
+
(0, assert_1.default)(err.errno === -9);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -54,7 +54,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
54
54
|
await pfs.chmod('./non-existent-source', 0o744);
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
|
-
assert_1.default(err.errno === -2);
|
|
57
|
+
(0, assert_1.default)(err.errno === -2);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
describe('sync mode', () => {
|
|
@@ -65,7 +65,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
65
65
|
});
|
|
66
66
|
const { mode } = await pfs.stat('./tmpdir/binapp');
|
|
67
67
|
const umask = src_1.default.bitmask(mode);
|
|
68
|
-
assert_1.default(umask === 0o744);
|
|
68
|
+
(0, assert_1.default)(umask === 0o744);
|
|
69
69
|
});
|
|
70
70
|
it('Positive: Must be changes directory when path is absolute', async () => {
|
|
71
71
|
const pfs = new src_1.default();
|
|
@@ -76,7 +76,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
76
76
|
});
|
|
77
77
|
const { mode } = await pfs.stat('./tmpdir/libxbase');
|
|
78
78
|
const umask = src_1.default.bitmask(mode);
|
|
79
|
-
assert_1.default(umask === 0o744);
|
|
79
|
+
(0, assert_1.default)(umask === 0o744);
|
|
80
80
|
});
|
|
81
81
|
it('Negative: Search permission is denied on a component of the path prefix', async () => {
|
|
82
82
|
const pfs = new src_1.default();
|
|
@@ -86,7 +86,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
catch (err) {
|
|
89
|
-
assert_1.default(err.errno === -9);
|
|
89
|
+
(0, assert_1.default)(err.errno === -9);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -97,9 +97,8 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
|
-
assert_1.default(err.errno === -2);
|
|
100
|
+
(0, assert_1.default)(err.errno === -2);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
//# sourceMappingURL=chmod.spec.js.map
|
package/lib/test/chown.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('chown(src, uid, gid [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -26,13 +26,13 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
await pfs.chown('./tmpdir', 0, 0);
|
|
28
28
|
const { uid, gid } = await pfs.stat('./tmpdir');
|
|
29
|
-
assert_1.default(uid === 0 && gid === 0);
|
|
29
|
+
(0, assert_1.default)(uid === 0 && gid === 0);
|
|
30
30
|
});
|
|
31
31
|
it('Positive: Changes the permissions of a directory', async () => {
|
|
32
32
|
const pfs = new src_1.default();
|
|
33
33
|
await pfs.chown('./tmpdir/libxbase', 0, 0);
|
|
34
34
|
const { uid, gid } = await pfs.stat('./tmpdir/libxbase');
|
|
35
|
-
assert_1.default(uid === 0 && gid === 0);
|
|
35
|
+
(0, assert_1.default)(uid === 0 && gid === 0);
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Changes the permissions of a file, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
44
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
44
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
45
45
|
});
|
|
46
46
|
it('Negative: To a non-existent resource to return an Error', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -49,7 +49,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
49
49
|
await pfs.chown('./non-existent-source', 1, 1);
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
|
-
assert_1.default(err.errno === -2);
|
|
52
|
+
(0, assert_1.default)(err.errno === -2);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
describe('sync mode', () => {
|
|
@@ -59,7 +59,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
59
59
|
sync: true
|
|
60
60
|
});
|
|
61
61
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
62
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
62
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
63
63
|
});
|
|
64
64
|
it('Positive: Changes the permissions of a directory', async () => {
|
|
65
65
|
const pfs = new src_1.default();
|
|
@@ -67,7 +67,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
67
67
|
sync: true
|
|
68
68
|
});
|
|
69
69
|
const { uid, gid } = await pfs.stat('./tmpdir');
|
|
70
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
70
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
71
71
|
});
|
|
72
72
|
it('Positive: Changes the permissions of a file, when path is absolute', async () => {
|
|
73
73
|
const pfs = new src_1.default();
|
|
@@ -77,7 +77,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
77
77
|
resolve: false
|
|
78
78
|
});
|
|
79
79
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
80
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
80
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
81
81
|
});
|
|
82
82
|
it(`Negative: To a non-existent resource to return an Error`, async () => {
|
|
83
83
|
const pfs = new src_1.default();
|
|
@@ -87,9 +87,8 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
catch (err) {
|
|
90
|
-
assert_1.default(err.errno === -2);
|
|
90
|
+
(0, assert_1.default)(err.errno === -2);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
|
-
//# sourceMappingURL=chown.spec.js.map
|
|
@@ -7,15 +7,14 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
7
7
|
const src_1 = __importDefault(require("../src"));
|
|
8
8
|
describe('#constructor: new PoweredFileSystem(path)', () => {
|
|
9
9
|
it('Positive: Must be backwards compatible with #require', () => {
|
|
10
|
-
assert_1.default(require('../src') === src_1.default);
|
|
10
|
+
(0, assert_1.default)(require('../src') === src_1.default);
|
|
11
11
|
});
|
|
12
12
|
it('Positive: An empty path must match the context of the cwd', () => {
|
|
13
13
|
const { pwd } = new src_1.default();
|
|
14
|
-
assert_1.default(pwd === process.cwd());
|
|
14
|
+
(0, assert_1.default)(pwd === process.cwd());
|
|
15
15
|
});
|
|
16
16
|
it('Positive: Absolute path must match the context of the pwd', () => {
|
|
17
17
|
const { pwd } = new src_1.default(__dirname);
|
|
18
|
-
assert_1.default(pwd === __dirname);
|
|
18
|
+
(0, assert_1.default)(pwd === __dirname);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
|
-
//# sourceMappingURL=constructor.spec.js.map
|
package/lib/test/copy.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
12
12
|
describe('copy(src, dir [, options])', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
const chance = new chance_1.default();
|
|
15
|
-
mock_fs_1.default({
|
|
15
|
+
(0, mock_fs_1.default)({
|
|
16
16
|
'tmpdir': {
|
|
17
17
|
'binapp': chance.string(),
|
|
18
18
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,7 +29,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
29
29
|
await pfs.copy('./tmpdir/binapp', dist);
|
|
30
30
|
const { mode } = await pfs.stat(`${dist}/binapp`);
|
|
31
31
|
const umask = src_1.default.bitmask(mode);
|
|
32
|
-
assert_1.default(umask === 0o666);
|
|
32
|
+
(0, assert_1.default)(umask === 0o666);
|
|
33
33
|
});
|
|
34
34
|
it('Positive: Recursive copying a directory', async () => {
|
|
35
35
|
const pfs = new src_1.default();
|
|
@@ -37,7 +37,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
37
37
|
await pfs.copy('./tmpdir', dist);
|
|
38
38
|
const { mode } = await pfs.stat(`${dist}/tmpdir/libxbase`);
|
|
39
39
|
const umask = src_1.default.bitmask(mode);
|
|
40
|
-
assert_1.default(umask === 0o777);
|
|
40
|
+
(0, assert_1.default)(umask === 0o777);
|
|
41
41
|
});
|
|
42
42
|
it('Positive: Recursive copying a directory. Permission check of file', async () => {
|
|
43
43
|
const pfs = new src_1.default();
|
|
@@ -45,7 +45,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
45
45
|
await pfs.copy('./tmpdir', dist);
|
|
46
46
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
47
47
|
const umask = src_1.default.bitmask(mode);
|
|
48
|
-
assert_1.default(umask === 0o666);
|
|
48
|
+
(0, assert_1.default)(umask === 0o666);
|
|
49
49
|
});
|
|
50
50
|
it('Positive: Copying a item file when path is absolute', async () => {
|
|
51
51
|
const pfs = new src_1.default();
|
|
@@ -56,7 +56,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
56
56
|
});
|
|
57
57
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
58
58
|
const umask = src_1.default.bitmask(mode);
|
|
59
|
-
assert_1.default(umask === 0o666);
|
|
59
|
+
(0, assert_1.default)(umask === 0o666);
|
|
60
60
|
});
|
|
61
61
|
it('Negative: Throw if not exists resource', async () => {
|
|
62
62
|
const pfs = new src_1.default();
|
|
@@ -64,7 +64,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
64
64
|
await pfs.copy('./non-existent', '.');
|
|
65
65
|
}
|
|
66
66
|
catch (err) {
|
|
67
|
-
assert_1.default(err.errno === -2);
|
|
67
|
+
(0, assert_1.default)(err.errno === -2);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
it('Negative: An attempt to copy to an existing resource should return an Error', async () => {
|
|
@@ -73,7 +73,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
73
73
|
await pfs.copy('./tmpdir', '.');
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
assert_1.default(err.errno === -17);
|
|
76
|
+
(0, assert_1.default)(err.errno === -17);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
describe('sync mode', () => {
|
|
@@ -85,7 +85,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
85
85
|
});
|
|
86
86
|
const { mode } = await pfs.stat(`${dist}/binapp`);
|
|
87
87
|
const umask = src_1.default.bitmask(mode);
|
|
88
|
-
assert_1.default(umask === 0o666);
|
|
88
|
+
(0, assert_1.default)(umask === 0o666);
|
|
89
89
|
});
|
|
90
90
|
it('Positive: Recursive copying a directory', async () => {
|
|
91
91
|
const pfs = new src_1.default();
|
|
@@ -95,7 +95,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
95
95
|
});
|
|
96
96
|
const { mode } = await pfs.stat(`${dist}/tmpdir/libxbase`);
|
|
97
97
|
const umask = src_1.default.bitmask(mode);
|
|
98
|
-
assert_1.default(umask === 0o777);
|
|
98
|
+
(0, assert_1.default)(umask === 0o777);
|
|
99
99
|
});
|
|
100
100
|
it('Positive: Copying a item file when path is absolute', async () => {
|
|
101
101
|
const pfs = new src_1.default();
|
|
@@ -107,7 +107,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
107
107
|
});
|
|
108
108
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
109
109
|
const umask = src_1.default.bitmask(mode);
|
|
110
|
-
assert_1.default(umask === 0o666);
|
|
110
|
+
(0, assert_1.default)(umask === 0o666);
|
|
111
111
|
});
|
|
112
112
|
it('Negative: Throw if not exists resource', async () => {
|
|
113
113
|
const pfs = new src_1.default();
|
|
@@ -117,7 +117,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
catch (err) {
|
|
120
|
-
assert_1.default(err.errno === -2);
|
|
120
|
+
(0, assert_1.default)(err.errno === -2);
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
it('Negative: An attempt to copy to an existing resource should return an Error', async () => {
|
|
@@ -128,9 +128,8 @@ describe('copy(src, dir [, options])', () => {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
catch (err) {
|
|
131
|
-
assert_1.default(err.errno === -17);
|
|
131
|
+
(0, assert_1.default)(err.errno === -17);
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
//# sourceMappingURL=copy.spec.js.map
|
package/lib/test/mkdir.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
12
12
|
describe('mkdir(src [, options])', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
const chance = new chance_1.default();
|
|
15
|
-
mock_fs_1.default({
|
|
15
|
+
(0, mock_fs_1.default)({
|
|
16
16
|
'tmpdir': {
|
|
17
17
|
'binapp': chance.string(),
|
|
18
18
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,19 +29,19 @@ describe('mkdir(src [, options])', () => {
|
|
|
29
29
|
const base = chance.guid();
|
|
30
30
|
await pfs.mkdir(`./tmpdir/${base}`);
|
|
31
31
|
const exist = await pfs.test(`./tmpdir/${base}`);
|
|
32
|
-
assert_1.default(exist);
|
|
32
|
+
(0, assert_1.default)(exist);
|
|
33
33
|
});
|
|
34
34
|
it(`Positive: Make current directory`, async () => {
|
|
35
35
|
const pfs = new src_1.default('./tmpdir');
|
|
36
36
|
await pfs.mkdir('.');
|
|
37
37
|
const exist = await pfs.test('.');
|
|
38
|
-
assert_1.default(exist);
|
|
38
|
+
(0, assert_1.default)(exist);
|
|
39
39
|
});
|
|
40
40
|
it(`Positive: Make current directory, when current directory is absolute path`, async () => {
|
|
41
41
|
const pfs = new src_1.default('./tmpdir');
|
|
42
42
|
await pfs.mkdir(process.cwd());
|
|
43
43
|
const exist = await pfs.test('.');
|
|
44
|
-
assert_1.default(exist);
|
|
44
|
+
(0, assert_1.default)(exist);
|
|
45
45
|
});
|
|
46
46
|
it('Positive: Should work fine with the existing directory', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -50,7 +50,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
50
50
|
for (const item of [base, base]) {
|
|
51
51
|
await pfs.mkdir(`./tmpdir/${item}`);
|
|
52
52
|
const exist = await pfs.test(`./tmpdir/${item}`);
|
|
53
|
-
assert_1.default(exist);
|
|
53
|
+
(0, assert_1.default)(exist);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
it('Positive: Create directories when path is absolute', async () => {
|
|
@@ -62,7 +62,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
62
62
|
resolve: false
|
|
63
63
|
});
|
|
64
64
|
const exist = await pfs.test(`${tmpdir}${path_1.sep}${base}`);
|
|
65
|
-
assert_1.default(exist);
|
|
65
|
+
(0, assert_1.default)(exist);
|
|
66
66
|
});
|
|
67
67
|
it('Negative: Throw an exception if trying to create a directory in file', async () => {
|
|
68
68
|
const pfs = new src_1.default();
|
|
@@ -72,7 +72,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
72
72
|
await pfs.mkdir(`./tmpdir/binapp/${base}`);
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
|
-
assert_1.default(err.errno === -20);
|
|
75
|
+
(0, assert_1.default)(err.errno === -20);
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
describe('sync mode', () => {
|
|
@@ -84,7 +84,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
84
84
|
sync: true
|
|
85
85
|
});
|
|
86
86
|
const exist = await pfs.test(`./tmpdir/${base}`);
|
|
87
|
-
assert_1.default(exist);
|
|
87
|
+
(0, assert_1.default)(exist);
|
|
88
88
|
});
|
|
89
89
|
it('Positive: Make current directory', async () => {
|
|
90
90
|
const pfs = new src_1.default('./tmpdir');
|
|
@@ -92,7 +92,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
92
92
|
sync: true
|
|
93
93
|
});
|
|
94
94
|
const exist = await pfs.test('.');
|
|
95
|
-
assert_1.default(exist);
|
|
95
|
+
(0, assert_1.default)(exist);
|
|
96
96
|
});
|
|
97
97
|
it('Positive: Should work fine with the existing directory', async () => {
|
|
98
98
|
const pfs = new src_1.default();
|
|
@@ -103,7 +103,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
103
103
|
sync: true
|
|
104
104
|
});
|
|
105
105
|
const exist = await pfs.test(`./tmpdir/${item}`);
|
|
106
|
-
assert_1.default(exist);
|
|
106
|
+
(0, assert_1.default)(exist);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
it('Positive: Create directories when path is absolute', async () => {
|
|
@@ -116,7 +116,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
116
116
|
resolve: false
|
|
117
117
|
});
|
|
118
118
|
const exist = await pfs.test(`${tmpdir}${path_1.sep}${base}`);
|
|
119
|
-
assert_1.default(exist);
|
|
119
|
+
(0, assert_1.default)(exist);
|
|
120
120
|
});
|
|
121
121
|
it('Positive: Create in current directories when path is absolute', async () => {
|
|
122
122
|
const pfs = new src_1.default();
|
|
@@ -128,7 +128,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
128
128
|
resolve: false
|
|
129
129
|
});
|
|
130
130
|
const exist = await pfs.test(base);
|
|
131
|
-
assert_1.default(exist);
|
|
131
|
+
(0, assert_1.default)(exist);
|
|
132
132
|
});
|
|
133
133
|
it('Negative: Throw an exception if trying to create a directory in file', async () => {
|
|
134
134
|
const pfs = new src_1.default();
|
|
@@ -140,9 +140,8 @@ describe('mkdir(src [, options])', () => {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
catch (err) {
|
|
143
|
-
assert_1.default(err.errno === -20);
|
|
143
|
+
(0, assert_1.default)(err.errno === -20);
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
|
-
//# sourceMappingURL=mkdir.spec.js.map
|
package/lib/test/read.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('read(src [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -25,14 +25,14 @@ describe('read(src [, options])', () => {
|
|
|
25
25
|
it('Positive: Must read content of file; String type by default', async () => {
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
const raw = await pfs.read('./tmpdir/binapp');
|
|
28
|
-
assert_1.default(raw.length > 0);
|
|
28
|
+
(0, assert_1.default)(raw.length > 0);
|
|
29
29
|
});
|
|
30
30
|
it('Positive: Must read Buffer content of file when encoding is null', async () => {
|
|
31
31
|
const pfs = new src_1.default();
|
|
32
32
|
const raw = await pfs.read('./tmpdir/binapp', {
|
|
33
33
|
encoding: null
|
|
34
34
|
});
|
|
35
|
-
assert_1.default(raw instanceof Buffer);
|
|
35
|
+
(0, assert_1.default)(raw instanceof Buffer);
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Must read content of file, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -40,7 +40,7 @@ describe('read(src [, options])', () => {
|
|
|
40
40
|
const raw = await pfs.read(`${cwd}${path_1.sep}tmpdir${path_1.sep}binapp`, {
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
|
-
assert_1.default(raw.length > 0);
|
|
43
|
+
(0, assert_1.default)(raw.length > 0);
|
|
44
44
|
});
|
|
45
45
|
it('Negative: Throw if resource is not file', async () => {
|
|
46
46
|
const pfs = new src_1.default();
|
|
@@ -48,7 +48,7 @@ describe('read(src [, options])', () => {
|
|
|
48
48
|
await pfs.read(`./tmpdir/libxbase`);
|
|
49
49
|
}
|
|
50
50
|
catch (err) {
|
|
51
|
-
assert_1.default(err.errno === -21);
|
|
51
|
+
(0, assert_1.default)(err.errno === -21);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -59,7 +59,7 @@ describe('read(src [, options])', () => {
|
|
|
59
59
|
await pfs.read(`./${base}`);
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
|
-
assert_1.default(err.errno === -2);
|
|
62
|
+
(0, assert_1.default)(err.errno === -2);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
describe('sync mode', () => {
|
|
@@ -68,7 +68,7 @@ describe('read(src [, options])', () => {
|
|
|
68
68
|
const { length } = pfs.read('./tmpdir/binapp', {
|
|
69
69
|
sync: true
|
|
70
70
|
});
|
|
71
|
-
assert_1.default(length > 0);
|
|
71
|
+
(0, assert_1.default)(length > 0);
|
|
72
72
|
});
|
|
73
73
|
it('Positive: Must read Buffer content of file when encoding is null', async () => {
|
|
74
74
|
const pfs = new src_1.default();
|
|
@@ -76,7 +76,7 @@ describe('read(src [, options])', () => {
|
|
|
76
76
|
encoding: null,
|
|
77
77
|
sync: true
|
|
78
78
|
});
|
|
79
|
-
assert_1.default(raw instanceof Buffer);
|
|
79
|
+
(0, assert_1.default)(raw instanceof Buffer);
|
|
80
80
|
});
|
|
81
81
|
it('Positive: Must read content of file, when path is absolute', async () => {
|
|
82
82
|
const pfs = new src_1.default();
|
|
@@ -85,7 +85,7 @@ describe('read(src [, options])', () => {
|
|
|
85
85
|
sync: true,
|
|
86
86
|
resolve: false
|
|
87
87
|
});
|
|
88
|
-
assert_1.default(length > 0);
|
|
88
|
+
(0, assert_1.default)(length > 0);
|
|
89
89
|
});
|
|
90
90
|
it(`Negative: Throw if not exists resource`, async () => {
|
|
91
91
|
const pfs = new src_1.default();
|
|
@@ -97,9 +97,8 @@ describe('read(src [, options])', () => {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
|
-
assert_1.default(err.errno === -2);
|
|
100
|
+
(0, assert_1.default)(err.errno === -2);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
//# sourceMappingURL=read.spec.js.map
|
package/lib/test/readdir.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('readdir(src[, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -47,7 +47,7 @@ describe('readdir(src[, options])', () => {
|
|
|
47
47
|
await pfs.readdir(`./tmpdir/binapp`);
|
|
48
48
|
}
|
|
49
49
|
catch (err) {
|
|
50
|
-
assert_1.default(err.errno === -20);
|
|
50
|
+
(0, assert_1.default)(err.errno === -20);
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -58,7 +58,7 @@ describe('readdir(src[, options])', () => {
|
|
|
58
58
|
await pfs.readdir(`./${base}`);
|
|
59
59
|
}
|
|
60
60
|
catch (err) {
|
|
61
|
-
assert_1.default(err.errno === -2);
|
|
61
|
+
(0, assert_1.default)(err.errno === -2);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
describe('sync mode', () => {
|
|
@@ -92,7 +92,7 @@ describe('readdir(src[, options])', () => {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
assert_1.default(err.errno === -20);
|
|
95
|
+
(0, assert_1.default)(err.errno === -20);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
it(`Negative: Throw if not exists resource`, async () => {
|
|
@@ -105,9 +105,8 @@ describe('readdir(src[, options])', () => {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
catch (err) {
|
|
108
|
-
assert_1.default(err.errno === -2);
|
|
108
|
+
(0, assert_1.default)(err.errno === -2);
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
//# sourceMappingURL=readdir.spec.js.map
|
package/lib/test/remove.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('remove(src [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -26,7 +26,7 @@ describe('remove(src [, options])', () => {
|
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
await pfs.remove('./tmpdir');
|
|
28
28
|
const exist = await pfs.test('./tmpdir');
|
|
29
|
-
assert_1.default(exist === false);
|
|
29
|
+
(0, assert_1.default)(exist === false);
|
|
30
30
|
});
|
|
31
31
|
it('Positive: Removal a directory with a file, when path is absolute', async () => {
|
|
32
32
|
const pfs = new src_1.default();
|
|
@@ -35,7 +35,7 @@ describe('remove(src [, options])', () => {
|
|
|
35
35
|
resolve: false
|
|
36
36
|
});
|
|
37
37
|
const exist = await pfs.test('./tmpdir');
|
|
38
|
-
assert_1.default(exist === false);
|
|
38
|
+
(0, assert_1.default)(exist === false);
|
|
39
39
|
});
|
|
40
40
|
it('Negative: Throw if not exists resource', async () => {
|
|
41
41
|
const pfs = new src_1.default();
|
|
@@ -45,7 +45,7 @@ describe('remove(src [, options])', () => {
|
|
|
45
45
|
await pfs.remove(`./${base}`);
|
|
46
46
|
}
|
|
47
47
|
catch (err) {
|
|
48
|
-
assert_1.default(err.errno === -2);
|
|
48
|
+
(0, assert_1.default)(err.errno === -2);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
describe('sync mode', () => {
|
|
@@ -55,7 +55,7 @@ describe('remove(src [, options])', () => {
|
|
|
55
55
|
sync: true
|
|
56
56
|
});
|
|
57
57
|
const exist = await pfs.test('./tmpdir');
|
|
58
|
-
assert_1.default(exist === false);
|
|
58
|
+
(0, assert_1.default)(exist === false);
|
|
59
59
|
});
|
|
60
60
|
it('Positive: Removal a directory with a file, when path is absolute', async () => {
|
|
61
61
|
const pfs = new src_1.default();
|
|
@@ -65,7 +65,7 @@ describe('remove(src [, options])', () => {
|
|
|
65
65
|
resolve: false
|
|
66
66
|
});
|
|
67
67
|
const exist = await pfs.test('./tmpdir');
|
|
68
|
-
assert_1.default(exist === false);
|
|
68
|
+
(0, assert_1.default)(exist === false);
|
|
69
69
|
});
|
|
70
70
|
it('Negative: Throw if not exists resource', async () => {
|
|
71
71
|
const pfs = new src_1.default();
|
|
@@ -77,9 +77,8 @@ describe('remove(src [, options])', () => {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
catch (err) {
|
|
80
|
-
assert_1.default(err.errno === -2);
|
|
80
|
+
(0, assert_1.default)(err.errno === -2);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
|
-
//# sourceMappingURL=remove.spec.js.map
|
package/lib/test/rename.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('rename(src, use [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -26,13 +26,13 @@ describe('rename(src, use [, options])', () => {
|
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
await pfs.rename('./tmpdir/binapp', './tmpdir/newapp');
|
|
28
28
|
const exist = await pfs.test('./tmpdir/newapp');
|
|
29
|
-
assert_1.default(exist);
|
|
29
|
+
(0, assert_1.default)(exist);
|
|
30
30
|
});
|
|
31
31
|
it('Positive: Must be recursive rename directory', async () => {
|
|
32
32
|
const pfs = new src_1.default();
|
|
33
33
|
await pfs.rename('./tmpdir/libxbase', './tmpdir/newxbase');
|
|
34
34
|
const exist = await pfs.test('./tmpdir/newxbase');
|
|
35
|
-
assert_1.default(exist);
|
|
35
|
+
(0, assert_1.default)(exist);
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Must be recursive rename directory, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('rename(src, use [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const exist = await pfs.test('./newxbase');
|
|
44
|
-
assert_1.default(exist);
|
|
44
|
+
(0, assert_1.default)(exist);
|
|
45
45
|
});
|
|
46
46
|
it('Negative: Throw if not exists resource', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -51,7 +51,7 @@ describe('rename(src, use [, options])', () => {
|
|
|
51
51
|
await pfs.rename(`./${base}`, './tmpdir/newapp');
|
|
52
52
|
}
|
|
53
53
|
catch (err) {
|
|
54
|
-
assert_1.default(err.errno === -2);
|
|
54
|
+
(0, assert_1.default)(err.errno === -2);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
describe('sync mode', () => {
|
|
@@ -61,7 +61,7 @@ describe('rename(src, use [, options])', () => {
|
|
|
61
61
|
sync: true
|
|
62
62
|
});
|
|
63
63
|
const exist = await pfs.test('./tmpdir/newapp');
|
|
64
|
-
assert_1.default(exist);
|
|
64
|
+
(0, assert_1.default)(exist);
|
|
65
65
|
});
|
|
66
66
|
it('Positive: Must be recursive rename directory', async () => {
|
|
67
67
|
const pfs = new src_1.default();
|
|
@@ -69,7 +69,7 @@ describe('rename(src, use [, options])', () => {
|
|
|
69
69
|
sync: true
|
|
70
70
|
});
|
|
71
71
|
const exist = await pfs.test('./tmpdir/newxbase');
|
|
72
|
-
assert_1.default(exist);
|
|
72
|
+
(0, assert_1.default)(exist);
|
|
73
73
|
});
|
|
74
74
|
it('Positive: Must be recursive rename directory, when path is absolute', async () => {
|
|
75
75
|
const pfs = new src_1.default();
|
|
@@ -79,7 +79,7 @@ describe('rename(src, use [, options])', () => {
|
|
|
79
79
|
resolve: false
|
|
80
80
|
});
|
|
81
81
|
const exist = await pfs.test('./newxbase');
|
|
82
|
-
assert_1.default(exist);
|
|
82
|
+
(0, assert_1.default)(exist);
|
|
83
83
|
});
|
|
84
84
|
it('Negative: Throw if not exists resource', async () => {
|
|
85
85
|
const pfs = new src_1.default();
|
|
@@ -91,9 +91,8 @@ describe('rename(src, use [, options])', () => {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
catch (err) {
|
|
94
|
-
assert_1.default(err.errno === -2);
|
|
94
|
+
(0, assert_1.default)(err.errno === -2);
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
|
-
//# sourceMappingURL=rename.spec.js.map
|
package/lib/test/stat.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('stat(src [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -25,17 +25,17 @@ describe('stat(src [, options])', () => {
|
|
|
25
25
|
it('Positive: Must return information a file', async () => {
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
const stats = await pfs.stat('./tmpdir/binapp');
|
|
28
|
-
assert_1.default(stats.isFile());
|
|
28
|
+
(0, assert_1.default)(stats.isFile());
|
|
29
29
|
});
|
|
30
30
|
it('Positive: Must return information a directory', async () => {
|
|
31
31
|
const pfs = new src_1.default();
|
|
32
32
|
const stats = await pfs.stat('./tmpdir/libxbase');
|
|
33
|
-
assert_1.default(stats.isDirectory());
|
|
33
|
+
(0, assert_1.default)(stats.isDirectory());
|
|
34
34
|
});
|
|
35
35
|
it('Positive: Must return information a symlink', async () => {
|
|
36
36
|
const pfs = new src_1.default();
|
|
37
37
|
const stats = await pfs.stat('./flexapp');
|
|
38
|
-
assert_1.default(stats.isSymbolicLink());
|
|
38
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
39
39
|
});
|
|
40
40
|
it('Positive: Must return stats information, when path is absolute', async () => {
|
|
41
41
|
const pfs = new src_1.default();
|
|
@@ -43,7 +43,7 @@ describe('stat(src [, options])', () => {
|
|
|
43
43
|
const stats = await pfs.stat(`${cwd}${path_1.sep}tmpdir`, {
|
|
44
44
|
resolve: false
|
|
45
45
|
});
|
|
46
|
-
assert_1.default(stats.isDirectory());
|
|
46
|
+
(0, assert_1.default)(stats.isDirectory());
|
|
47
47
|
});
|
|
48
48
|
it('Negative: Throw if not exists resource', async () => {
|
|
49
49
|
const pfs = new src_1.default();
|
|
@@ -53,7 +53,7 @@ describe('stat(src [, options])', () => {
|
|
|
53
53
|
await pfs.stat(`./${base}`);
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
assert_1.default(err.errno === -2);
|
|
56
|
+
(0, assert_1.default)(err.errno === -2);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
describe('sync mode', () => {
|
|
@@ -62,21 +62,21 @@ describe('stat(src [, options])', () => {
|
|
|
62
62
|
const stats = pfs.stat('./tmpdir/binapp', {
|
|
63
63
|
sync: true
|
|
64
64
|
});
|
|
65
|
-
assert_1.default(stats.isFile());
|
|
65
|
+
(0, assert_1.default)(stats.isFile());
|
|
66
66
|
});
|
|
67
67
|
it('Positive: Must return information a directory in ', async () => {
|
|
68
68
|
const pfs = new src_1.default();
|
|
69
69
|
const stats = pfs.stat('./tmpdir/libxbase', {
|
|
70
70
|
sync: true
|
|
71
71
|
});
|
|
72
|
-
assert_1.default(stats.isDirectory());
|
|
72
|
+
(0, assert_1.default)(stats.isDirectory());
|
|
73
73
|
});
|
|
74
74
|
it('Positive: Must return information a symlink', async () => {
|
|
75
75
|
const pfs = new src_1.default();
|
|
76
76
|
const stats = pfs.stat('./flexapp', {
|
|
77
77
|
sync: true
|
|
78
78
|
});
|
|
79
|
-
assert_1.default(stats.isSymbolicLink());
|
|
79
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
80
80
|
});
|
|
81
81
|
it('Positive: Must return stats information, when path is absolute', async () => {
|
|
82
82
|
const pfs = new src_1.default();
|
|
@@ -85,7 +85,7 @@ describe('stat(src [, options])', () => {
|
|
|
85
85
|
sync: true,
|
|
86
86
|
resolve: false
|
|
87
87
|
});
|
|
88
|
-
assert_1.default(stats.isDirectory());
|
|
88
|
+
(0, assert_1.default)(stats.isDirectory());
|
|
89
89
|
});
|
|
90
90
|
it('Negative: Throw if not exists resource', async () => {
|
|
91
91
|
const pfs = new src_1.default();
|
|
@@ -97,9 +97,8 @@ describe('stat(src [, options])', () => {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
|
-
assert_1.default(err.errno === -2);
|
|
100
|
+
(0, assert_1.default)(err.errno === -2);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
//# sourceMappingURL=stat.spec.js.map
|
package/lib/test/symlink.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('symlink(src, use [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -26,13 +26,13 @@ describe('symlink(src, use [, options])', () => {
|
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
await pfs.symlink('./tmpdir/binapp', './linkapp');
|
|
28
28
|
const stats = await pfs.stat('./linkapp');
|
|
29
|
-
assert_1.default(stats.isSymbolicLink());
|
|
29
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
30
30
|
});
|
|
31
31
|
it('Positive: Must be created a symbolic link for directory', async () => {
|
|
32
32
|
const pfs = new src_1.default();
|
|
33
33
|
await pfs.symlink(`./tmpdir/libxbase`, './linkapp');
|
|
34
34
|
const stats = await pfs.stat('./linkapp');
|
|
35
|
-
assert_1.default(stats.isSymbolicLink());
|
|
35
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Must be created a symbolic, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const stats = await pfs.stat('./linkapp');
|
|
44
|
-
assert_1.default(stats.isSymbolicLink());
|
|
44
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
45
45
|
});
|
|
46
46
|
it('Negative: Throw if destination already exists', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -49,7 +49,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
49
49
|
await pfs.symlink(`./flexapp`, './tmpdir/binapp');
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
|
-
assert_1.default(err.errno === -17);
|
|
52
|
+
(0, assert_1.default)(err.errno === -17);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -60,7 +60,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
60
60
|
await pfs.symlink(`./${base}`, './linkapp');
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
|
-
assert_1.default(err.errno === -2);
|
|
63
|
+
(0, assert_1.default)(err.errno === -2);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
describe('sync mode', () => {
|
|
@@ -70,7 +70,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
70
70
|
sync: true
|
|
71
71
|
});
|
|
72
72
|
const stats = await pfs.stat('./linkapp');
|
|
73
|
-
assert_1.default(stats.isSymbolicLink());
|
|
73
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
74
74
|
});
|
|
75
75
|
it('Positive: Must be created a symbolic link for directory', async () => {
|
|
76
76
|
const pfs = new src_1.default();
|
|
@@ -78,7 +78,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
78
78
|
sync: true
|
|
79
79
|
});
|
|
80
80
|
const stats = await pfs.stat('./linkapp');
|
|
81
|
-
assert_1.default(stats.isSymbolicLink());
|
|
81
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
82
82
|
});
|
|
83
83
|
it('Positive: Must be created a symbolic, when path is absolute', async () => {
|
|
84
84
|
const pfs = new src_1.default();
|
|
@@ -88,7 +88,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
88
88
|
resolve: false
|
|
89
89
|
});
|
|
90
90
|
const stats = await pfs.stat('./linkapp');
|
|
91
|
-
assert_1.default(stats.isSymbolicLink());
|
|
91
|
+
(0, assert_1.default)(stats.isSymbolicLink());
|
|
92
92
|
});
|
|
93
93
|
it('Negative: Throw if destination already exists', async () => {
|
|
94
94
|
const pfs = new src_1.default();
|
|
@@ -98,7 +98,7 @@ describe('symlink(src, use [, options])', () => {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
catch (err) {
|
|
101
|
-
assert_1.default(err.errno === -17);
|
|
101
|
+
(0, assert_1.default)(err.errno === -17);
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -111,9 +111,8 @@ describe('symlink(src, use [, options])', () => {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
catch (err) {
|
|
114
|
-
assert_1.default(err.errno === -2);
|
|
114
|
+
(0, assert_1.default)(err.errno === -2);
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
-
//# sourceMappingURL=symlink.spec.js.map
|
package/lib/test/test.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('test(src[, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -25,24 +25,24 @@ describe('test(src[, options])', () => {
|
|
|
25
25
|
it(`Positive: Should return 'true' for current working directory`, async () => {
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
const exist = await pfs.test('.');
|
|
28
|
-
assert_1.default(exist);
|
|
28
|
+
(0, assert_1.default)(exist);
|
|
29
29
|
});
|
|
30
30
|
it(`Positive: For existing directory should return 'true'`, async () => {
|
|
31
31
|
const pfs = new src_1.default();
|
|
32
32
|
const exist = await pfs.test('./tmpdir/libxbase');
|
|
33
|
-
assert_1.default(exist);
|
|
33
|
+
(0, assert_1.default)(exist);
|
|
34
34
|
});
|
|
35
35
|
it(`Positive: For existing file should return 'true'`, async () => {
|
|
36
36
|
const pfs = new src_1.default();
|
|
37
37
|
const exist = await pfs.test('./tmpdir/binapp');
|
|
38
|
-
assert_1.default(exist);
|
|
38
|
+
(0, assert_1.default)(exist);
|
|
39
39
|
});
|
|
40
40
|
it(`Positive: A non-existent file must return 'false'`, async () => {
|
|
41
41
|
const pfs = new src_1.default();
|
|
42
42
|
const chance = new chance_1.default();
|
|
43
43
|
const base = chance.guid();
|
|
44
44
|
const exists = await pfs.test(`./${base}`);
|
|
45
|
-
assert_1.default(exists === false);
|
|
45
|
+
(0, assert_1.default)(exists === false);
|
|
46
46
|
});
|
|
47
47
|
it(`Positive: Should return 'true' for absolute source`, async () => {
|
|
48
48
|
const pfs = new src_1.default();
|
|
@@ -50,7 +50,7 @@ describe('test(src[, options])', () => {
|
|
|
50
50
|
const exists = await pfs.test(`${cwd}${path_1.sep}tmpdir`, {
|
|
51
51
|
resolve: false
|
|
52
52
|
});
|
|
53
|
-
assert_1.default(exists);
|
|
53
|
+
(0, assert_1.default)(exists);
|
|
54
54
|
});
|
|
55
55
|
describe('sync mode', () => {
|
|
56
56
|
it(`Positive: For existing directory should return 'true'`, () => {
|
|
@@ -58,14 +58,14 @@ describe('test(src[, options])', () => {
|
|
|
58
58
|
const exist = pfs.test('./tmpdir/libxbase', {
|
|
59
59
|
sync: true
|
|
60
60
|
});
|
|
61
|
-
assert_1.default(exist);
|
|
61
|
+
(0, assert_1.default)(exist);
|
|
62
62
|
});
|
|
63
63
|
it(`Positive: For existing file should return 'true'`, () => {
|
|
64
64
|
const pfs = new src_1.default();
|
|
65
65
|
const exist = pfs.test('./tmpdir/binapp', {
|
|
66
66
|
sync: true
|
|
67
67
|
});
|
|
68
|
-
assert_1.default(exist);
|
|
68
|
+
(0, assert_1.default)(exist);
|
|
69
69
|
});
|
|
70
70
|
it(`Positive: A non-existent file must return 'false'`, async () => {
|
|
71
71
|
const pfs = new src_1.default();
|
|
@@ -74,7 +74,7 @@ describe('test(src[, options])', () => {
|
|
|
74
74
|
const exists = pfs.test(`./${base}`, {
|
|
75
75
|
sync: true
|
|
76
76
|
});
|
|
77
|
-
assert_1.default(exists === false);
|
|
77
|
+
(0, assert_1.default)(exists === false);
|
|
78
78
|
});
|
|
79
79
|
it(`Positive: Should return 'true' for absolute source`, async () => {
|
|
80
80
|
const pfs = new src_1.default();
|
|
@@ -83,8 +83,7 @@ describe('test(src[, options])', () => {
|
|
|
83
83
|
sync: true,
|
|
84
84
|
resolve: false
|
|
85
85
|
});
|
|
86
|
-
assert_1.default(exists);
|
|
86
|
+
(0, assert_1.default)(exists);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
-
//# sourceMappingURL=test.spec.js.map
|
package/lib/test/write.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('write(src, data[, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -27,11 +27,11 @@ describe('write(src, data[, options])', () => {
|
|
|
27
27
|
const chance = new chance_1.default();
|
|
28
28
|
const base = chance.guid();
|
|
29
29
|
const exists = await pfs.test(`./tmpdir/${base}`);
|
|
30
|
-
assert_1.default(exists === false);
|
|
30
|
+
(0, assert_1.default)(exists === false);
|
|
31
31
|
const payload = chance.paragraph();
|
|
32
32
|
await pfs.write(`./tmpdir/${base}`, payload);
|
|
33
33
|
const stats = await pfs.stat(`./tmpdir/${base}`);
|
|
34
|
-
assert_1.default(stats.size > 0);
|
|
34
|
+
(0, assert_1.default)(stats.size > 0);
|
|
35
35
|
});
|
|
36
36
|
it('Positive: Must rewrite content if file already exists', async () => {
|
|
37
37
|
const pfs = new src_1.default();
|
|
@@ -39,7 +39,7 @@ describe('write(src, data[, options])', () => {
|
|
|
39
39
|
const payload = chance.paragraph();
|
|
40
40
|
await pfs.write('./tmpdir/binapp', payload);
|
|
41
41
|
const stats = await pfs.stat(`./tmpdir/binapp`);
|
|
42
|
-
assert_1.default(stats.size > 0);
|
|
42
|
+
(0, assert_1.default)(stats.size > 0);
|
|
43
43
|
});
|
|
44
44
|
it(`Positive: Must write content to file, when path is absolute`, async () => {
|
|
45
45
|
const pfs = new src_1.default();
|
|
@@ -50,7 +50,7 @@ describe('write(src, data[, options])', () => {
|
|
|
50
50
|
resolve: false
|
|
51
51
|
});
|
|
52
52
|
const stats = await pfs.stat(`./tmpdir/binapp`);
|
|
53
|
-
assert_1.default(stats.size > 0);
|
|
53
|
+
(0, assert_1.default)(stats.size > 0);
|
|
54
54
|
});
|
|
55
55
|
it('Negative: Throw if resource is directory', async () => {
|
|
56
56
|
const pfs = new src_1.default();
|
|
@@ -60,7 +60,7 @@ describe('write(src, data[, options])', () => {
|
|
|
60
60
|
await pfs.write('./tmpdir/libxbase', payload);
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
|
-
assert_1.default(err.errno === -21);
|
|
63
|
+
(0, assert_1.default)(err.errno === -21);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
@@ -73,7 +73,7 @@ describe('write(src, data[, options])', () => {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
assert_1.default(err.errno === -9);
|
|
76
|
+
(0, assert_1.default)(err.errno === -9);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
describe('sync mode', () => {
|
|
@@ -82,13 +82,13 @@ describe('write(src, data[, options])', () => {
|
|
|
82
82
|
const chance = new chance_1.default();
|
|
83
83
|
const base = chance.guid();
|
|
84
84
|
const exists = await pfs.test(`./tmpdir/${base}`);
|
|
85
|
-
assert_1.default(exists === false);
|
|
85
|
+
(0, assert_1.default)(exists === false);
|
|
86
86
|
const payload = chance.paragraph();
|
|
87
87
|
pfs.write(`./tmpdir/${base}`, payload, {
|
|
88
88
|
sync: true
|
|
89
89
|
});
|
|
90
90
|
const stats = await pfs.stat(`./tmpdir/${base}`);
|
|
91
|
-
assert_1.default(stats.size > 0);
|
|
91
|
+
(0, assert_1.default)(stats.size > 0);
|
|
92
92
|
});
|
|
93
93
|
it(`Positive: Must write content to file, when path is absolute`, async () => {
|
|
94
94
|
const pfs = new src_1.default();
|
|
@@ -100,7 +100,7 @@ describe('write(src, data[, options])', () => {
|
|
|
100
100
|
resolve: false
|
|
101
101
|
});
|
|
102
102
|
const stats = await pfs.stat(`./tmpdir/binapp`);
|
|
103
|
-
assert_1.default(stats.size > 0);
|
|
103
|
+
(0, assert_1.default)(stats.size > 0);
|
|
104
104
|
});
|
|
105
105
|
it('Negative: Throw if resource is directory', async () => {
|
|
106
106
|
const pfs = new src_1.default();
|
|
@@ -112,7 +112,7 @@ describe('write(src, data[, options])', () => {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
catch (err) {
|
|
115
|
-
assert_1.default(err.errno === -21);
|
|
115
|
+
(0, assert_1.default)(err.errno === -21);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
@@ -126,9 +126,8 @@ describe('write(src, data[, options])', () => {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
catch (err) {
|
|
129
|
-
assert_1.default(err.errno === -9);
|
|
129
|
+
(0, assert_1.default)(err.errno === -9);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
|
-
//# sourceMappingURL=write.spec.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pwd-fs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Extend the file system the capabilities of declaring the present working directory and recursive execution",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"umask",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"remove",
|
|
15
15
|
"read",
|
|
16
16
|
"write",
|
|
17
|
-
"append",
|
|
18
17
|
"readdir",
|
|
19
18
|
"mkdir"
|
|
20
19
|
],
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"test": "mocha ./lib/test"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@tsconfig/
|
|
39
|
+
"@tsconfig/node16": "^1.0.3",
|
|
41
40
|
"@types/chance": "^1.1.1",
|
|
42
41
|
"@types/mocha": "^10.0.0",
|
|
43
42
|
"@types/mock-fs": "^4.13.0",
|
package/readme.md
CHANGED
|
@@ -37,7 +37,7 @@ npm i pwd-fs
|
|
|
37
37
|
* [pfs.remove(src[, options])](#pfsremovesrc-options)
|
|
38
38
|
* [pfs.read(src[, options])](#pfsreadsrc-options)
|
|
39
39
|
* [pfs.write(src, data[, options])](#pfswritesrc-data-options)
|
|
40
|
-
* [pfs.append(src, data[, options])](#pfsappendsrc-data-options)
|
|
40
|
+
* [pfs.append(src, data[, options])](#pfsappendsrc-data-options-deprecated) `deprecated`
|
|
41
41
|
* [pfs.readdir(dir[, options])](#pfsreaddirdir-options)
|
|
42
42
|
* [pfs.mkdir(dir[, options])](#pfsmkdirdir-options)
|
|
43
43
|
* [pfs.pwd](#pfspwd)
|
|
@@ -47,7 +47,7 @@ The scope `URI` of the class methods are divided into groups.
|
|
|
47
47
|
| URI | Methods |
|
|
48
48
|
|-----------------------------|------------------------------------------------------------------|
|
|
49
49
|
| Common (file and directory) | `chmod` `chown` `copy` `remove` `rename` `symlink` `stat` `test` |
|
|
50
|
-
| File only | `
|
|
50
|
+
| File only | `read` `write` |
|
|
51
51
|
| Directory only | `mkdir` `readdir` |
|
|
52
52
|
|
|
53
53
|
|
|
@@ -269,7 +269,8 @@ await pfs.write('./file.txt', '... some text');
|
|
|
269
269
|
|
|
270
270
|
> This function is limited to writing only `string`. For `stream`, `fs.createWriteStream()` is recommended.
|
|
271
271
|
|
|
272
|
-
#### pfs.append(src, data[, options])
|
|
272
|
+
#### pfs.append(src, data[, options]) `deprecated`
|
|
273
|
+
|
|
273
274
|
|
|
274
275
|
- `src` <[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)> Absolute or relative path to the resource in the file system. Relative paths will be resolved relative to the present working directory as specified by `pfs.pwd`.
|
|
275
276
|
- `data` <[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>
|
|
@@ -283,9 +284,9 @@ await pfs.write('./file.txt', '... some text');
|
|
|
283
284
|
|
|
284
285
|
Asynchronously append data to a file, creating the file if it does not yet exist.
|
|
285
286
|
|
|
286
|
-
> NOTE Method is deprecated.
|
|
287
|
+
> NOTE Method is deprecated. May be removed in the next major version
|
|
287
288
|
|
|
288
|
-
**Use
|
|
289
|
+
**Use instead [pfs.write(src, data[, options])](#pfswritesrc-data-options) with { flag: 'a' } option**
|
|
289
290
|
|
|
290
291
|
```ts
|
|
291
292
|
await pfs.write('./file', 'some content', {
|
|
@@ -362,7 +363,7 @@ Encoding | Description
|
|
|
362
363
|
|
|
363
364
|
#### File system flags
|
|
364
365
|
|
|
365
|
-
The following flags are available for `pfs.read
|
|
366
|
+
The following flags are available for `pfs.read` and `pfs.write` the flag option takes a <[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>.
|
|
366
367
|
|
|
367
368
|
Flag | Description
|
|
368
369
|
-----|------------
|
package/src/index.ts
CHANGED
|
@@ -472,8 +472,6 @@ export default class PoweredFileSystem {
|
|
|
472
472
|
umask?: number,
|
|
473
473
|
flag?: Flag
|
|
474
474
|
} = {}) {
|
|
475
|
-
console.log(`'append' with be removed in the next major version. Use 'write' with { flag: 'a' } option`);
|
|
476
|
-
|
|
477
475
|
if (resolve) {
|
|
478
476
|
src = this.resolve(src);
|
|
479
477
|
}
|