@zenfs/core 0.1.0 → 0.2.0
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/ApiError.d.ts +51 -14
- package/dist/ApiError.js +60 -34
- package/dist/FileIndex.d.ts +32 -35
- package/dist/FileIndex.js +93 -109
- package/dist/backends/AsyncMirror.d.ts +42 -43
- package/dist/backends/AsyncMirror.js +146 -133
- package/dist/backends/AsyncStore.d.ts +29 -28
- package/dist/backends/AsyncStore.js +139 -189
- package/dist/backends/InMemory.d.ts +16 -13
- package/dist/backends/InMemory.js +29 -14
- package/dist/backends/Locked.d.ts +8 -28
- package/dist/backends/Locked.js +44 -148
- package/dist/backends/OverlayFS.d.ts +26 -34
- package/dist/backends/OverlayFS.js +208 -371
- package/dist/backends/SyncStore.d.ts +54 -72
- package/dist/backends/SyncStore.js +159 -161
- package/dist/backends/backend.d.ts +45 -29
- package/dist/backends/backend.js +83 -13
- package/dist/backends/index.d.ts +6 -7
- package/dist/backends/index.js +5 -6
- package/dist/browser.min.js +5 -7
- package/dist/browser.min.js.map +4 -4
- package/dist/emulation/callbacks.d.ts +36 -67
- package/dist/emulation/callbacks.js +90 -46
- package/dist/emulation/constants.js +1 -1
- package/dist/emulation/promises.d.ts +228 -129
- package/dist/emulation/promises.js +414 -172
- package/dist/emulation/shared.d.ts +10 -10
- package/dist/emulation/shared.js +18 -20
- package/dist/emulation/sync.d.ts +25 -25
- package/dist/emulation/sync.js +187 -73
- package/dist/file.d.ts +166 -170
- package/dist/file.js +199 -218
- package/dist/filesystem.d.ts +68 -241
- package/dist/filesystem.js +59 -383
- package/dist/index.d.ts +7 -44
- package/dist/index.js +13 -52
- package/dist/inode.d.ts +37 -28
- package/dist/inode.js +123 -65
- package/dist/stats.d.ts +21 -19
- package/dist/stats.js +35 -56
- package/dist/utils.d.ts +26 -9
- package/dist/utils.js +73 -102
- package/package.json +4 -3
|
@@ -13,21 +13,19 @@ import { Cred } from '../cred.js';
|
|
|
13
13
|
* multiple requests interleaving.
|
|
14
14
|
*/
|
|
15
15
|
export default class LockedFS<T extends FileSystem> implements FileSystem {
|
|
16
|
-
|
|
16
|
+
readonly fs: T;
|
|
17
17
|
private _mu;
|
|
18
|
-
protected _ready: Promise<this>;
|
|
19
18
|
constructor(fs: T);
|
|
20
|
-
|
|
19
|
+
ready(): Promise<this>;
|
|
21
20
|
get metadata(): FileSystemMetadata;
|
|
22
|
-
get fs(): T;
|
|
23
21
|
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
24
22
|
renameSync(oldPath: string, newPath: string, cred: Cred): void;
|
|
25
23
|
stat(p: string, cred: Cred): Promise<Stats>;
|
|
26
24
|
statSync(p: string, cred: Cred): Stats;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
openFile(path: string, flag: FileFlag, cred: Cred): Promise<File>;
|
|
26
|
+
openFileSync(path: string, flag: FileFlag, cred: Cred): File;
|
|
27
|
+
createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise<File>;
|
|
28
|
+
createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File;
|
|
31
29
|
unlink(p: string, cred: Cred): Promise<void>;
|
|
32
30
|
unlinkSync(p: string, cred: Cred): void;
|
|
33
31
|
rmdir(p: string, cred: Cred): Promise<void>;
|
|
@@ -38,26 +36,8 @@ export default class LockedFS<T extends FileSystem> implements FileSystem {
|
|
|
38
36
|
readdirSync(p: string, cred: Cred): string[];
|
|
39
37
|
exists(p: string, cred: Cred): Promise<boolean>;
|
|
40
38
|
existsSync(p: string, cred: Cred): boolean;
|
|
41
|
-
realpath(p: string, cred: Cred): Promise<string>;
|
|
42
|
-
realpathSync(p: string, cred: Cred): string;
|
|
43
|
-
truncate(p: string, len: number, cred: Cred): Promise<void>;
|
|
44
|
-
truncateSync(p: string, len: number, cred: Cred): void;
|
|
45
|
-
readFile(fname: string, flag: FileFlag, cred: Cred): Promise<Uint8Array>;
|
|
46
|
-
readFileSync(fname: string, flag: FileFlag, cred: Cred): Uint8Array;
|
|
47
|
-
writeFile(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): Promise<void>;
|
|
48
|
-
writeFileSync(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): void;
|
|
49
|
-
appendFile(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): Promise<void>;
|
|
50
|
-
appendFileSync(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): void;
|
|
51
|
-
chmod(p: string, mode: number, cred: Cred): Promise<void>;
|
|
52
|
-
chmodSync(p: string, mode: number, cred: Cred): void;
|
|
53
|
-
chown(p: string, new_uid: number, new_gid: number, cred: Cred): Promise<void>;
|
|
54
|
-
chownSync(p: string, new_uid: number, new_gid: number, cred: Cred): void;
|
|
55
|
-
utimes(p: string, atime: Date, mtime: Date, cred: Cred): Promise<void>;
|
|
56
|
-
utimesSync(p: string, atime: Date, mtime: Date, cred: Cred): void;
|
|
57
39
|
link(srcpath: string, dstpath: string, cred: Cred): Promise<void>;
|
|
58
40
|
linkSync(srcpath: string, dstpath: string, cred: Cred): void;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
readlink(p: string, cred: Cred): Promise<string>;
|
|
62
|
-
readlinkSync(p: string, cred: Cred): string;
|
|
41
|
+
sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
|
|
42
|
+
syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
|
|
63
43
|
}
|
package/dist/backends/Locked.js
CHANGED
|
@@ -10,36 +10,33 @@ import Mutex from '../mutex.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export default class LockedFS {
|
|
12
12
|
constructor(fs) {
|
|
13
|
-
this.
|
|
14
|
-
this._fs = fs;
|
|
13
|
+
this.fs = fs;
|
|
15
14
|
this._mu = new Mutex();
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
async ready() {
|
|
17
|
+
await this.fs.ready();
|
|
18
|
+
return this;
|
|
19
19
|
}
|
|
20
20
|
get metadata() {
|
|
21
21
|
return {
|
|
22
|
-
...this.
|
|
23
|
-
name: '
|
|
22
|
+
...this.fs.metadata,
|
|
23
|
+
name: 'Locked<' + this.fs.metadata.name + '>',
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
get fs() {
|
|
27
|
-
return this._fs;
|
|
28
|
-
}
|
|
29
26
|
async rename(oldPath, newPath, cred) {
|
|
30
27
|
await this._mu.lock(oldPath);
|
|
31
|
-
await this.
|
|
28
|
+
await this.fs.rename(oldPath, newPath, cred);
|
|
32
29
|
this._mu.unlock(oldPath);
|
|
33
30
|
}
|
|
34
31
|
renameSync(oldPath, newPath, cred) {
|
|
35
32
|
if (this._mu.isLocked(oldPath)) {
|
|
36
33
|
throw new Error('invalid sync call');
|
|
37
34
|
}
|
|
38
|
-
return this.
|
|
35
|
+
return this.fs.renameSync(oldPath, newPath, cred);
|
|
39
36
|
}
|
|
40
37
|
async stat(p, cred) {
|
|
41
38
|
await this._mu.lock(p);
|
|
42
|
-
const stats = await this.
|
|
39
|
+
const stats = await this.fs.stat(p, cred);
|
|
43
40
|
this._mu.unlock(p);
|
|
44
41
|
return stats;
|
|
45
42
|
}
|
|
@@ -47,67 +44,68 @@ export default class LockedFS {
|
|
|
47
44
|
if (this._mu.isLocked(p)) {
|
|
48
45
|
throw new Error('invalid sync call');
|
|
49
46
|
}
|
|
50
|
-
return this.
|
|
47
|
+
return this.fs.statSync(p, cred);
|
|
51
48
|
}
|
|
52
|
-
async
|
|
53
|
-
await this._mu.lock(
|
|
54
|
-
await this.
|
|
55
|
-
this._mu.unlock(
|
|
49
|
+
async openFile(path, flag, cred) {
|
|
50
|
+
await this._mu.lock(path);
|
|
51
|
+
const fd = await this.fs.openFile(path, flag, cred);
|
|
52
|
+
this._mu.unlock(path);
|
|
53
|
+
return fd;
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
if (this._mu.isLocked(
|
|
55
|
+
openFileSync(path, flag, cred) {
|
|
56
|
+
if (this._mu.isLocked(path)) {
|
|
59
57
|
throw new Error('invalid sync call');
|
|
60
58
|
}
|
|
61
|
-
return this.
|
|
59
|
+
return this.fs.openFileSync(path, flag, cred);
|
|
62
60
|
}
|
|
63
|
-
async
|
|
64
|
-
await this._mu.lock(
|
|
65
|
-
const fd = await this.
|
|
66
|
-
this._mu.unlock(
|
|
61
|
+
async createFile(path, flag, mode, cred) {
|
|
62
|
+
await this._mu.lock(path);
|
|
63
|
+
const fd = await this.fs.createFile(path, flag, mode, cred);
|
|
64
|
+
this._mu.unlock(path);
|
|
67
65
|
return fd;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
if (this._mu.isLocked(
|
|
67
|
+
createFileSync(path, flag, mode, cred) {
|
|
68
|
+
if (this._mu.isLocked(path)) {
|
|
71
69
|
throw new Error('invalid sync call');
|
|
72
70
|
}
|
|
73
|
-
return this.
|
|
71
|
+
return this.fs.createFileSync(path, flag, mode, cred);
|
|
74
72
|
}
|
|
75
73
|
async unlink(p, cred) {
|
|
76
74
|
await this._mu.lock(p);
|
|
77
|
-
await this.
|
|
75
|
+
await this.fs.unlink(p, cred);
|
|
78
76
|
this._mu.unlock(p);
|
|
79
77
|
}
|
|
80
78
|
unlinkSync(p, cred) {
|
|
81
79
|
if (this._mu.isLocked(p)) {
|
|
82
80
|
throw new Error('invalid sync call');
|
|
83
81
|
}
|
|
84
|
-
return this.
|
|
82
|
+
return this.fs.unlinkSync(p, cred);
|
|
85
83
|
}
|
|
86
84
|
async rmdir(p, cred) {
|
|
87
85
|
await this._mu.lock(p);
|
|
88
|
-
await this.
|
|
86
|
+
await this.fs.rmdir(p, cred);
|
|
89
87
|
this._mu.unlock(p);
|
|
90
88
|
}
|
|
91
89
|
rmdirSync(p, cred) {
|
|
92
90
|
if (this._mu.isLocked(p)) {
|
|
93
91
|
throw new Error('invalid sync call');
|
|
94
92
|
}
|
|
95
|
-
return this.
|
|
93
|
+
return this.fs.rmdirSync(p, cred);
|
|
96
94
|
}
|
|
97
95
|
async mkdir(p, mode, cred) {
|
|
98
96
|
await this._mu.lock(p);
|
|
99
|
-
await this.
|
|
97
|
+
await this.fs.mkdir(p, mode, cred);
|
|
100
98
|
this._mu.unlock(p);
|
|
101
99
|
}
|
|
102
100
|
mkdirSync(p, mode, cred) {
|
|
103
101
|
if (this._mu.isLocked(p)) {
|
|
104
102
|
throw new Error('invalid sync call');
|
|
105
103
|
}
|
|
106
|
-
return this.
|
|
104
|
+
return this.fs.mkdirSync(p, mode, cred);
|
|
107
105
|
}
|
|
108
106
|
async readdir(p, cred) {
|
|
109
107
|
await this._mu.lock(p);
|
|
110
|
-
const files = await this.
|
|
108
|
+
const files = await this.fs.readdir(p, cred);
|
|
111
109
|
this._mu.unlock(p);
|
|
112
110
|
return files;
|
|
113
111
|
}
|
|
@@ -115,11 +113,11 @@ export default class LockedFS {
|
|
|
115
113
|
if (this._mu.isLocked(p)) {
|
|
116
114
|
throw new Error('invalid sync call');
|
|
117
115
|
}
|
|
118
|
-
return this.
|
|
116
|
+
return this.fs.readdirSync(p, cred);
|
|
119
117
|
}
|
|
120
118
|
async exists(p, cred) {
|
|
121
119
|
await this._mu.lock(p);
|
|
122
|
-
const exists = await this.
|
|
120
|
+
const exists = await this.fs.exists(p, cred);
|
|
123
121
|
this._mu.unlock(p);
|
|
124
122
|
return exists;
|
|
125
123
|
}
|
|
@@ -127,130 +125,28 @@ export default class LockedFS {
|
|
|
127
125
|
if (this._mu.isLocked(p)) {
|
|
128
126
|
throw new Error('invalid sync call');
|
|
129
127
|
}
|
|
130
|
-
return this.
|
|
131
|
-
}
|
|
132
|
-
async realpath(p, cred) {
|
|
133
|
-
await this._mu.lock(p);
|
|
134
|
-
const resolvedPath = await this._fs.realpath(p, cred);
|
|
135
|
-
this._mu.unlock(p);
|
|
136
|
-
return resolvedPath;
|
|
137
|
-
}
|
|
138
|
-
realpathSync(p, cred) {
|
|
139
|
-
if (this._mu.isLocked(p)) {
|
|
140
|
-
throw new Error('invalid sync call');
|
|
141
|
-
}
|
|
142
|
-
return this._fs.realpathSync(p, cred);
|
|
143
|
-
}
|
|
144
|
-
async truncate(p, len, cred) {
|
|
145
|
-
await this._mu.lock(p);
|
|
146
|
-
await this._fs.truncate(p, len, cred);
|
|
147
|
-
this._mu.unlock(p);
|
|
148
|
-
}
|
|
149
|
-
truncateSync(p, len, cred) {
|
|
150
|
-
if (this._mu.isLocked(p)) {
|
|
151
|
-
throw new Error('invalid sync call');
|
|
152
|
-
}
|
|
153
|
-
return this._fs.truncateSync(p, len, cred);
|
|
154
|
-
}
|
|
155
|
-
async readFile(fname, flag, cred) {
|
|
156
|
-
await this._mu.lock(fname);
|
|
157
|
-
const data = await this._fs.readFile(fname, flag, cred);
|
|
158
|
-
this._mu.unlock(fname);
|
|
159
|
-
return data;
|
|
160
|
-
}
|
|
161
|
-
readFileSync(fname, flag, cred) {
|
|
162
|
-
if (this._mu.isLocked(fname)) {
|
|
163
|
-
throw new Error('invalid sync call');
|
|
164
|
-
}
|
|
165
|
-
return this._fs.readFileSync(fname, flag, cred);
|
|
166
|
-
}
|
|
167
|
-
async writeFile(fname, data, flag, mode, cred) {
|
|
168
|
-
await this._mu.lock(fname);
|
|
169
|
-
await this._fs.writeFile(fname, data, flag, mode, cred);
|
|
170
|
-
this._mu.unlock(fname);
|
|
171
|
-
}
|
|
172
|
-
writeFileSync(fname, data, flag, mode, cred) {
|
|
173
|
-
if (this._mu.isLocked(fname)) {
|
|
174
|
-
throw new Error('invalid sync call');
|
|
175
|
-
}
|
|
176
|
-
return this._fs.writeFileSync(fname, data, flag, mode, cred);
|
|
177
|
-
}
|
|
178
|
-
async appendFile(fname, data, flag, mode, cred) {
|
|
179
|
-
await this._mu.lock(fname);
|
|
180
|
-
await this._fs.appendFile(fname, data, flag, mode, cred);
|
|
181
|
-
this._mu.unlock(fname);
|
|
182
|
-
}
|
|
183
|
-
appendFileSync(fname, data, flag, mode, cred) {
|
|
184
|
-
if (this._mu.isLocked(fname)) {
|
|
185
|
-
throw new Error('invalid sync call');
|
|
186
|
-
}
|
|
187
|
-
return this._fs.appendFileSync(fname, data, flag, mode, cred);
|
|
188
|
-
}
|
|
189
|
-
async chmod(p, mode, cred) {
|
|
190
|
-
await this._mu.lock(p);
|
|
191
|
-
await this._fs.chmod(p, mode, cred);
|
|
192
|
-
this._mu.unlock(p);
|
|
193
|
-
}
|
|
194
|
-
chmodSync(p, mode, cred) {
|
|
195
|
-
if (this._mu.isLocked(p)) {
|
|
196
|
-
throw new Error('invalid sync call');
|
|
197
|
-
}
|
|
198
|
-
return this._fs.chmodSync(p, mode, cred);
|
|
199
|
-
}
|
|
200
|
-
async chown(p, new_uid, new_gid, cred) {
|
|
201
|
-
await this._mu.lock(p);
|
|
202
|
-
await this._fs.chown(p, new_uid, new_gid, cred);
|
|
203
|
-
this._mu.unlock(p);
|
|
204
|
-
}
|
|
205
|
-
chownSync(p, new_uid, new_gid, cred) {
|
|
206
|
-
if (this._mu.isLocked(p)) {
|
|
207
|
-
throw new Error('invalid sync call');
|
|
208
|
-
}
|
|
209
|
-
return this._fs.chownSync(p, new_uid, new_gid, cred);
|
|
210
|
-
}
|
|
211
|
-
async utimes(p, atime, mtime, cred) {
|
|
212
|
-
await this._mu.lock(p);
|
|
213
|
-
await this._fs.utimes(p, atime, mtime, cred);
|
|
214
|
-
this._mu.unlock(p);
|
|
215
|
-
}
|
|
216
|
-
utimesSync(p, atime, mtime, cred) {
|
|
217
|
-
if (this._mu.isLocked(p)) {
|
|
218
|
-
throw new Error('invalid sync call');
|
|
219
|
-
}
|
|
220
|
-
return this._fs.utimesSync(p, atime, mtime, cred);
|
|
128
|
+
return this.fs.existsSync(p, cred);
|
|
221
129
|
}
|
|
222
130
|
async link(srcpath, dstpath, cred) {
|
|
223
131
|
await this._mu.lock(srcpath);
|
|
224
|
-
await this.
|
|
132
|
+
await this.fs.link(srcpath, dstpath, cred);
|
|
225
133
|
this._mu.unlock(srcpath);
|
|
226
134
|
}
|
|
227
135
|
linkSync(srcpath, dstpath, cred) {
|
|
228
136
|
if (this._mu.isLocked(srcpath)) {
|
|
229
137
|
throw new Error('invalid sync call');
|
|
230
138
|
}
|
|
231
|
-
return this.
|
|
232
|
-
}
|
|
233
|
-
async symlink(srcpath, dstpath, type, cred) {
|
|
234
|
-
await this._mu.lock(srcpath);
|
|
235
|
-
await this._fs.symlink(srcpath, dstpath, type, cred);
|
|
236
|
-
this._mu.unlock(srcpath);
|
|
237
|
-
}
|
|
238
|
-
symlinkSync(srcpath, dstpath, type, cred) {
|
|
239
|
-
if (this._mu.isLocked(srcpath)) {
|
|
240
|
-
throw new Error('invalid sync call');
|
|
241
|
-
}
|
|
242
|
-
return this._fs.symlinkSync(srcpath, dstpath, type, cred);
|
|
139
|
+
return this.fs.linkSync(srcpath, dstpath, cred);
|
|
243
140
|
}
|
|
244
|
-
async
|
|
245
|
-
await this._mu.lock(
|
|
246
|
-
|
|
247
|
-
this._mu.unlock(
|
|
248
|
-
return linkString;
|
|
141
|
+
async sync(path, data, stats) {
|
|
142
|
+
await this._mu.lock(path);
|
|
143
|
+
await this.fs.sync(path, data, stats);
|
|
144
|
+
this._mu.unlock(path);
|
|
249
145
|
}
|
|
250
|
-
|
|
251
|
-
if (this._mu.isLocked(
|
|
146
|
+
syncSync(path, data, stats) {
|
|
147
|
+
if (this._mu.isLocked(path)) {
|
|
252
148
|
throw new Error('invalid sync call');
|
|
253
149
|
}
|
|
254
|
-
return this.
|
|
150
|
+
return this.fs.syncSync(path, data, stats);
|
|
255
151
|
}
|
|
256
152
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { File, FileFlag
|
|
1
|
+
import { FileSystem, FileSystemMetadata } from '../filesystem.js';
|
|
2
|
+
import { File, FileFlag } from '../file.js';
|
|
3
3
|
import { Stats } from '../stats.js';
|
|
4
4
|
import LockedFS from './Locked.js';
|
|
5
5
|
import { Cred } from '../cred.js';
|
|
6
|
-
import {
|
|
6
|
+
import type { Backend } from './backend.js';
|
|
7
7
|
export declare namespace OverlayFS {
|
|
8
8
|
/**
|
|
9
9
|
* Configuration options for OverlayFS instances.
|
|
@@ -20,13 +20,15 @@ export declare namespace OverlayFS {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* OverlayFS makes a read-only filesystem writable by storing writes on a second, writable file system.
|
|
24
|
+
* Deletes are persisted via metadata stored on the writable file system.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* This class contains no locking whatsoever. It is wrapped in a LockedFS to prevent races.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
27
29
|
*/
|
|
28
|
-
export declare class UnlockedOverlayFS extends
|
|
29
|
-
|
|
30
|
+
export declare class UnlockedOverlayFS extends FileSystem {
|
|
31
|
+
ready(): Promise<this>;
|
|
30
32
|
private _writable;
|
|
31
33
|
private _readable;
|
|
32
34
|
private _isInitialized;
|
|
@@ -34,19 +36,16 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
34
36
|
private _deleteLog;
|
|
35
37
|
private _deleteLogUpdatePending;
|
|
36
38
|
private _deleteLogUpdateNeeded;
|
|
37
|
-
private _deleteLogError
|
|
39
|
+
private _deleteLogError?;
|
|
40
|
+
private _ready;
|
|
38
41
|
constructor({ writable, readable }: OverlayFS.Options);
|
|
39
42
|
get metadata(): FileSystemMetadata;
|
|
40
|
-
getOverlayedFileSystems():
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
_syncAsync(file: PreloadFile<UnlockedOverlayFS>): Promise<void>;
|
|
45
|
-
_syncSync(file: PreloadFile<UnlockedOverlayFS>): void;
|
|
43
|
+
getOverlayedFileSystems(): OverlayFS.Options;
|
|
44
|
+
sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
|
|
45
|
+
syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
|
|
46
46
|
/**
|
|
47
|
-
* **INTERNAL METHOD**
|
|
48
|
-
*
|
|
49
47
|
* Called once to load up metadata stored on the writable file system.
|
|
48
|
+
* @internal
|
|
50
49
|
*/
|
|
51
50
|
_initialize(): Promise<void>;
|
|
52
51
|
getDeletionLog(): string;
|
|
@@ -55,8 +54,12 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
55
54
|
renameSync(oldPath: string, newPath: string, cred: Cred): void;
|
|
56
55
|
stat(p: string, cred: Cred): Promise<Stats>;
|
|
57
56
|
statSync(p: string, cred: Cred): Stats;
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
openFile(path: string, flag: FileFlag, cred: Cred): Promise<File>;
|
|
58
|
+
openFileSync(path: string, flag: FileFlag, cred: Cred): File;
|
|
59
|
+
createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise<File>;
|
|
60
|
+
createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File;
|
|
61
|
+
link(srcpath: string, dstpath: string, cred: Cred): Promise<void>;
|
|
62
|
+
linkSync(srcpath: string, dstpath: string, cred: Cred): void;
|
|
60
63
|
unlink(p: string, cred: Cred): Promise<void>;
|
|
61
64
|
unlinkSync(p: string, cred: Cred): void;
|
|
62
65
|
rmdir(p: string, cred: Cred): Promise<void>;
|
|
@@ -65,14 +68,6 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
65
68
|
mkdirSync(p: string, mode: number, cred: Cred): void;
|
|
66
69
|
readdir(p: string, cred: Cred): Promise<string[]>;
|
|
67
70
|
readdirSync(p: string, cred: Cred): string[];
|
|
68
|
-
exists(p: string, cred: Cred): Promise<boolean>;
|
|
69
|
-
existsSync(p: string, cred: Cred): boolean;
|
|
70
|
-
chmod(p: string, mode: number, cred: Cred): Promise<void>;
|
|
71
|
-
chmodSync(p: string, mode: number, cred: Cred): void;
|
|
72
|
-
chown(p: string, new_uid: number, new_gid: number, cred: Cred): Promise<void>;
|
|
73
|
-
chownSync(p: string, new_uid: number, new_gid: number, cred: Cred): void;
|
|
74
|
-
utimes(p: string, atime: Date, mtime: Date, cred: Cred): Promise<void>;
|
|
75
|
-
utimesSync(p: string, atime: Date, mtime: Date, cred: Cred): void;
|
|
76
71
|
private deletePath;
|
|
77
72
|
private updateLog;
|
|
78
73
|
private _reparseDeletionLog;
|
|
@@ -82,8 +77,8 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
82
77
|
* With the given path, create the needed parent directories on the writable storage
|
|
83
78
|
* should they not exist. Use modes from the read-only storage.
|
|
84
79
|
*/
|
|
80
|
+
private createParentDirectoriesSync;
|
|
85
81
|
private createParentDirectories;
|
|
86
|
-
private createParentDirectoriesAsync;
|
|
87
82
|
/**
|
|
88
83
|
* Helper function:
|
|
89
84
|
* - Ensures p is on writable before proceeding. Throws an error if it doesn't exist.
|
|
@@ -95,8 +90,8 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
95
90
|
* Copy from readable to writable storage.
|
|
96
91
|
* PRECONDITION: File does not exist on writable storage.
|
|
97
92
|
*/
|
|
93
|
+
private copyToWritableSync;
|
|
98
94
|
private copyToWritable;
|
|
99
|
-
private copyToWritableAsync;
|
|
100
95
|
}
|
|
101
96
|
/**
|
|
102
97
|
* OverlayFS makes a read-only filesystem writable by storing writes on a second,
|
|
@@ -104,10 +99,7 @@ export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
|
104
99
|
* file system.
|
|
105
100
|
*/
|
|
106
101
|
export declare class OverlayFS extends LockedFS<UnlockedOverlayFS> {
|
|
107
|
-
|
|
108
|
-
static Create: any;
|
|
109
|
-
static readonly Options: BackendOptions;
|
|
110
|
-
static isAvailable(): boolean;
|
|
102
|
+
ready(): Promise<this>;
|
|
111
103
|
/**
|
|
112
104
|
* @param options The options to initialize the OverlayFS with
|
|
113
105
|
*/
|
|
@@ -116,5 +108,5 @@ export declare class OverlayFS extends LockedFS<UnlockedOverlayFS> {
|
|
|
116
108
|
getDeletionLog(): string;
|
|
117
109
|
resDeletionLog(): string;
|
|
118
110
|
unwrap(): UnlockedOverlayFS;
|
|
119
|
-
private _initialize;
|
|
120
111
|
}
|
|
112
|
+
export declare const Overlay: Backend;
|