pwd-fs 3.2.4 → 3.3.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/dist/bitmask.d.ts +4 -0
- package/dist/bitmask.js +17 -0
- package/dist/bitmask.test.d.ts +1 -0
- package/dist/bitmask.test.js +29 -0
- package/dist/{src/index.d.ts → index.d.ts} +3 -0
- package/dist/{src/index.js → index.js} +3 -0
- package/dist/powered-file-system/append.d.ts +9 -0
- package/dist/powered-file-system/append.js +10 -0
- package/dist/powered-file-system/append.test.d.ts +1 -0
- package/dist/powered-file-system/append.test.js +47 -0
- package/dist/powered-file-system/chmod.d.ts +7 -0
- package/dist/powered-file-system/chmod.js +28 -0
- package/dist/powered-file-system/chmod.test.d.ts +1 -0
- package/dist/powered-file-system/chmod.test.js +71 -0
- package/dist/powered-file-system/chown.d.ts +9 -0
- package/dist/powered-file-system/chown.js +45 -0
- package/dist/powered-file-system/chown.test.d.ts +1 -0
- package/dist/powered-file-system/chown.test.js +82 -0
- package/dist/powered-file-system/copy.d.ts +8 -0
- package/dist/powered-file-system/copy.js +29 -0
- package/dist/powered-file-system/copy.test.d.ts +1 -0
- package/dist/powered-file-system/copy.test.js +82 -0
- package/dist/powered-file-system/mkdir.d.ts +8 -0
- package/dist/powered-file-system/mkdir.js +28 -0
- package/dist/powered-file-system/mkdir.test.d.ts +1 -0
- package/dist/powered-file-system/mkdir.test.js +116 -0
- package/dist/powered-file-system/read.d.ts +9 -0
- package/dist/powered-file-system/read.js +29 -0
- package/dist/powered-file-system/read.test.d.ts +1 -0
- package/dist/powered-file-system/read.test.js +75 -0
- package/dist/powered-file-system/readdir.d.ts +8 -0
- package/dist/powered-file-system/readdir.js +26 -0
- package/dist/powered-file-system/readdir.test.d.ts +1 -0
- package/dist/powered-file-system/readdir.test.js +72 -0
- package/dist/powered-file-system/remove.d.ts +7 -0
- package/dist/powered-file-system/remove.js +36 -0
- package/dist/powered-file-system/remove.test.d.ts +1 -0
- package/dist/powered-file-system/remove.test.js +78 -0
- package/dist/powered-file-system/rename.d.ts +7 -0
- package/dist/powered-file-system/rename.js +28 -0
- package/dist/powered-file-system/rename.test.d.ts +1 -0
- package/dist/powered-file-system/rename.test.js +70 -0
- package/dist/powered-file-system/stat.d.ts +7 -0
- package/dist/powered-file-system/stat.js +26 -0
- package/dist/powered-file-system/stat.test.d.ts +1 -0
- package/dist/powered-file-system/stat.test.js +79 -0
- package/dist/powered-file-system/symlink.d.ts +4 -0
- package/dist/powered-file-system/symlink.js +52 -0
- package/dist/powered-file-system/symlink.test.d.ts +1 -0
- package/dist/powered-file-system/symlink.test.js +77 -0
- package/dist/powered-file-system/test.d.ts +8 -0
- package/dist/powered-file-system/test.js +30 -0
- package/dist/powered-file-system/test.test.d.ts +1 -0
- package/dist/powered-file-system/test.test.js +76 -0
- package/dist/powered-file-system/write.d.ts +10 -0
- package/dist/powered-file-system/write.js +36 -0
- package/dist/powered-file-system/write.test.d.ts +1 -0
- package/dist/powered-file-system/write.test.js +97 -0
- package/dist/powered-file-system.d.ts +127 -0
- package/dist/powered-file-system.js +144 -0
- package/dist/powered-file-system.test.d.ts +1 -0
- package/dist/powered-file-system.test.js +21 -0
- package/dist/recurse-io-sync.d.ts +20 -0
- package/dist/{src/recurse-io-sync.js → recurse-io-sync.js} +37 -37
- package/dist/{src/recurse-io.d.ts → recurse-io.d.ts} +15 -1
- package/dist/{src/recurse-io.js → recurse-io.js} +52 -58
- package/dist/suite.test.d.ts +1 -0
- package/dist/suite.test.js +40 -0
- package/dist/test-utils.d.ts +18 -0
- package/dist/test-utils.js +72 -0
- package/package.json +31 -14
- package/readme.md +331 -246
- package/.travis.yml +0 -12
- package/appveyor.yml +0 -16
- package/dist/src/bitmask.d.ts +0 -1
- package/dist/src/bitmask.js +0 -18
- package/dist/src/powered-file-system.d.ts +0 -173
- package/dist/src/powered-file-system.js +0 -262
- package/dist/src/recurse-io-sync.d.ts +0 -5
- package/src/bitmask.ts +0 -20
- package/src/index.ts +0 -7
- package/src/powered-file-system.ts +0 -508
- package/src/recurse-io-sync.ts +0 -108
- package/src/recurse-io.ts +0 -238
- package/test/__fmock.ts +0 -45
- package/test/append.spec.ts +0 -71
- package/test/bitmask.spec.ts +0 -23
- package/test/chmod.spec.ts +0 -77
- package/test/chown.spec.ts +0 -92
- package/test/constructor.spec.ts +0 -15
- package/test/copy.spec.ts +0 -101
- package/test/mkdir.spec.ts +0 -121
- package/test/read.spec.ts +0 -91
- package/test/readdir.spec.ts +0 -86
- package/test/remove.spec.ts +0 -78
- package/test/rename.spec.ts +0 -84
- package/test/stat.spec.ts +0 -99
- package/test/symlink.spec.ts +0 -95
- package/test/test.spec.ts +0 -80
- package/test/write.spec.ts +0 -104
- package/tsconfig.json +0 -14
package/test/test.spec.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import Chance from 'chance';
|
|
3
|
-
import { fmock, restore } from './__fmock';
|
|
4
|
-
import { pfs } from '../src';
|
|
5
|
-
|
|
6
|
-
describe('test(src[, options])', () => {
|
|
7
|
-
const chance = new Chance();
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
fmock({
|
|
11
|
-
'./tmpdir/tings.txt': {
|
|
12
|
-
type: 'file',
|
|
13
|
-
data: chance.string()
|
|
14
|
-
},
|
|
15
|
-
'./tmpdir/digest/': { type: 'directory' }
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
restore('./tmpdir');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
it(`Positive: Should return 'true' for current working directory`, async () => {
|
|
25
|
-
const exist = await pfs.test('.');
|
|
26
|
-
|
|
27
|
-
assert(exist);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
it(`Positive: For existing file should return 'true'`, async () => {
|
|
32
|
-
const exist = await pfs.test('./tmpdir/tings.txt');
|
|
33
|
-
|
|
34
|
-
assert(exist);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
it(`Positive: For existing directory should return 'true'`, async () => {
|
|
39
|
-
const exist = await pfs.test('./tmpdir/digest');
|
|
40
|
-
|
|
41
|
-
assert(exist);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
it(`Positive: A non-existent file must return 'false'`, async () => {
|
|
46
|
-
const guid = chance.guid();
|
|
47
|
-
const exist = await pfs.test(`./tmpdir/${guid}`);
|
|
48
|
-
|
|
49
|
-
assert(exist === false);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
it(`Positive: For existing file should return 'true'`, () => {
|
|
54
|
-
const exist = pfs.test('./tmpdir/tings.txt', {
|
|
55
|
-
sync: true
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
assert(exist);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
it(`[sync] Positive: For existing directory should return 'true'`, () => {
|
|
63
|
-
const exist = pfs.test('./tmpdir/digest', {
|
|
64
|
-
sync: true
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
assert(exist);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
it(`[sync] Positive: A non-existent file must return 'false'`, () => {
|
|
72
|
-
const guid = chance.guid();
|
|
73
|
-
|
|
74
|
-
const exist = pfs.test(`./tmpdir/${guid}`, {
|
|
75
|
-
sync: true
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
assert(exist === false);
|
|
79
|
-
});
|
|
80
|
-
});
|
package/test/write.spec.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import Chance from 'chance';
|
|
4
|
-
import { expect } from 'expect';
|
|
5
|
-
import { fmock, restore } from './__fmock';
|
|
6
|
-
import { pfs } from '../src';
|
|
7
|
-
|
|
8
|
-
describe('write(src, data[, options])', () => {
|
|
9
|
-
const chance = new Chance();
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
fmock({
|
|
13
|
-
'./tmpdir/tings.txt': {
|
|
14
|
-
type: 'file',
|
|
15
|
-
data: chance.string()
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
restore('./tmpdir');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('Positive: Must write content to file', async () => {
|
|
25
|
-
const payload = chance.paragraph();
|
|
26
|
-
const guid = chance.guid();
|
|
27
|
-
|
|
28
|
-
await pfs.write(`./tmpdir/${guid}.txt`, payload);
|
|
29
|
-
const { size } = fs.lstatSync(`./tmpdir/${guid}.txt`);
|
|
30
|
-
|
|
31
|
-
assert(payload.length === size);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
it('Positive: Must rewrite content if file already exists', async () => {
|
|
36
|
-
const payload = chance.paragraph();
|
|
37
|
-
|
|
38
|
-
await pfs.write('./tmpdir/tings.txt', payload);
|
|
39
|
-
const { size } = fs.lstatSync('./tmpdir/tings.txt');
|
|
40
|
-
|
|
41
|
-
assert(payload.length === size);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
it('Negative: Throw if resource is directory', async () => {
|
|
46
|
-
const payload = chance.paragraph();
|
|
47
|
-
|
|
48
|
-
await expect(async () => {
|
|
49
|
-
await pfs.write('./tmpdir', payload);
|
|
50
|
-
})
|
|
51
|
-
.rejects
|
|
52
|
-
.toThrow();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
57
|
-
const payload = chance.paragraph();
|
|
58
|
-
|
|
59
|
-
await expect(async () => {
|
|
60
|
-
await pfs.write('./tmpdir/tings.txt', payload, {
|
|
61
|
-
flag: 'r'
|
|
62
|
-
});
|
|
63
|
-
})
|
|
64
|
-
.rejects
|
|
65
|
-
.toThrow();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
it('[sync] Positive: Write contents even to a non-existent file', () => {
|
|
70
|
-
const payload = chance.paragraph();
|
|
71
|
-
const guid = chance.guid();
|
|
72
|
-
|
|
73
|
-
pfs.write(`./tmpdir/${guid}.txt`, payload, {
|
|
74
|
-
sync: true
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const content = fs.readFileSync(`./tmpdir/${guid}.txt`, 'utf8');
|
|
78
|
-
|
|
79
|
-
assert(payload === content);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
it('[sync] Negative: Throw if resource is directory', () => {
|
|
84
|
-
const payload = chance.paragraph();
|
|
85
|
-
|
|
86
|
-
assert.throws(() => {
|
|
87
|
-
pfs.write('./tmpdir', payload, {
|
|
88
|
-
sync: true
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
it(`[sync] Negative: Unexpected option 'flag' returns Error`, () => {
|
|
95
|
-
const payload = chance.paragraph();
|
|
96
|
-
|
|
97
|
-
assert.throws(() => {
|
|
98
|
-
pfs.write('./tmpdir/tings.txt', payload, {
|
|
99
|
-
sync: true,
|
|
100
|
-
flag: 'r'
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
package/tsconfig.json
DELETED