@zenfs/core 0.12.1 → 0.12.3
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/backends/backend.d.ts +1 -1
- package/dist/backends/fetch.d.ts +1 -1
- package/dist/backends/index/fs.d.ts +2 -1
- package/dist/backends/index/index.d.ts +2 -1
- package/dist/backends/overlay.d.ts +4 -3
- package/dist/backends/overlay.js +1 -1
- package/dist/backends/port/fs.d.ts +5 -1
- package/dist/backends/port/fs.js +13 -10
- package/dist/browser.min.js +4 -8
- package/dist/browser.min.js.map +3 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/cred.d.ts +2 -1
- package/dist/emulation/async.d.ts +6 -5
- package/dist/emulation/index.d.ts +1 -1
- package/dist/emulation/index.js +1 -1
- package/dist/emulation/promises.d.ts +5 -5
- package/dist/emulation/promises.js +31 -51
- package/dist/emulation/shared.d.ts +8 -2
- package/dist/emulation/shared.js +18 -1
- package/dist/emulation/streams.d.ts +1 -1
- package/dist/emulation/sync.d.ts +5 -5
- package/dist/emulation/sync.js +94 -76
- package/dist/error.d.ts +1 -1
- package/dist/error.js +1 -1
- package/dist/file.d.ts +7 -23
- package/dist/file.js +33 -80
- package/dist/filesystem.d.ts +35 -31
- package/dist/filesystem.js +10 -14
- package/dist/stats.d.ts +17 -17
- package/dist/stats.js +42 -49
- package/dist/utils.d.ts +2 -2
- package/license.md +2 -26
- package/package.json +2 -2
- package/readme.md +1 -1
- package/src/backends/backend.ts +1 -1
- package/src/backends/fetch.ts +1 -1
- package/src/backends/index/fs.ts +2 -1
- package/src/backends/index/index.ts +2 -1
- package/src/backends/overlay.ts +7 -4
- package/src/backends/port/fs.ts +14 -10
- package/src/config.ts +1 -1
- package/src/cred.ts +2 -1
- package/src/emulation/async.ts +8 -7
- package/src/emulation/index.ts +1 -1
- package/src/emulation/promises.ts +40 -54
- package/src/emulation/shared.ts +24 -3
- package/src/emulation/streams.ts +1 -1
- package/src/emulation/sync.ts +100 -87
- package/src/error.ts +1 -1
- package/src/file.ts +35 -88
- package/src/filesystem.ts +40 -32
- package/src/stats.ts +47 -59
- package/src/utils.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequiredKeys } from 'utilium';
|
|
2
|
-
import { FileSystem } from '../filesystem.js';
|
|
2
|
+
import type { FileSystem } from '../filesystem.js';
|
|
3
3
|
type OptionType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the type of Backend.options from the options interface
|
package/dist/backends/fetch.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { Cred } from '../../cred.js';
|
|
|
2
2
|
import { NoSyncFile } from '../../file.js';
|
|
3
3
|
import { FileSystem } from '../../filesystem.js';
|
|
4
4
|
import type { Stats } from '../../stats.js';
|
|
5
|
-
import {
|
|
5
|
+
import type { IndexData } from './index.js';
|
|
6
|
+
import { Index } from './index.js';
|
|
6
7
|
declare const IndexFS_base: (abstract new (...args: any[]) => {
|
|
7
8
|
metadata(): import("../../filesystem.js").FileSystemMetadata;
|
|
8
9
|
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { FileSystemMetadata } from '../filesystem.js';
|
|
2
|
+
import { FileSystem } from '../filesystem.js';
|
|
3
|
+
import type { File } from '../file.js';
|
|
3
4
|
import { Stats } from '../stats.js';
|
|
4
5
|
import { LockedFS } from './locked.js';
|
|
5
|
-
import { Cred } from '../cred.js';
|
|
6
|
+
import type { Cred } from '../cred.js';
|
|
6
7
|
/**
|
|
7
8
|
* Configuration options for OverlayFS instances.
|
|
8
9
|
*/
|
package/dist/backends/overlay.js
CHANGED
|
@@ -166,7 +166,7 @@ export class UnlockedOverlayFS extends FileSystem {
|
|
|
166
166
|
}
|
|
167
167
|
// Create an OverlayFile.
|
|
168
168
|
const file = this._readable.openFileSync(path, parseFlag('r'), cred);
|
|
169
|
-
const stats = Stats
|
|
169
|
+
const stats = new Stats(file.statSync());
|
|
170
170
|
const data = new Uint8Array(stats.size);
|
|
171
171
|
file.readSync(data);
|
|
172
172
|
return new PreloadFile(this, path, flag, stats, data);
|
|
@@ -16,6 +16,7 @@ export declare class PortFile extends File {
|
|
|
16
16
|
position: number;
|
|
17
17
|
constructor(fs: PortFS, fd: number, path: string, position: number);
|
|
18
18
|
rpc<const T extends FileMethod & string>(method: T, ...args: Parameters<FileMethods[T]>): Promise<Awaited<ReturnType<FileMethods[T]>>>;
|
|
19
|
+
protected _throwNoSync(syscall: string): never;
|
|
19
20
|
stat(): Promise<Stats>;
|
|
20
21
|
statSync(): Stats;
|
|
21
22
|
truncate(len: number): Promise<void>;
|
|
@@ -61,7 +62,10 @@ declare const PortFS_base: (abstract new (...args: any[]) => {
|
|
|
61
62
|
createFile(path: string, flag: string, mode: number, cred: Cred): Promise<File>;
|
|
62
63
|
unlink(path: string, cred: Cred): Promise<void>;
|
|
63
64
|
rmdir(path: string, cred: Cred): Promise<void>;
|
|
64
|
-
mkdir(path: string, mode: number, cred: Cred): Promise<void>;
|
|
65
|
+
mkdir(path: string, mode: number, cred: Cred): Promise<void>; /**
|
|
66
|
+
* Constructs a new PortFS instance that connects with ZenFS running on
|
|
67
|
+
* the specified port.
|
|
68
|
+
*/
|
|
65
69
|
readdir(path: string, cred: Cred): Promise<string[]>;
|
|
66
70
|
exists(path: string, cred: Cred): Promise<boolean>;
|
|
67
71
|
existsSync(path: string, cred: Cred): boolean;
|
package/dist/backends/port/fs.js
CHANGED
|
@@ -20,66 +20,69 @@ export class PortFile extends File {
|
|
|
20
20
|
args,
|
|
21
21
|
}, this.fs.options);
|
|
22
22
|
}
|
|
23
|
+
_throwNoSync(syscall) {
|
|
24
|
+
throw new ErrnoError(Errno.ENOTSUP, 'Syncrohnous operations not support on PortFile', this.path, syscall);
|
|
25
|
+
}
|
|
23
26
|
stat() {
|
|
24
27
|
return this.rpc('stat');
|
|
25
28
|
}
|
|
26
29
|
statSync() {
|
|
27
|
-
|
|
30
|
+
this._throwNoSync('stat');
|
|
28
31
|
}
|
|
29
32
|
truncate(len) {
|
|
30
33
|
return this.rpc('truncate', len);
|
|
31
34
|
}
|
|
32
35
|
truncateSync() {
|
|
33
|
-
|
|
36
|
+
this._throwNoSync('truncate');
|
|
34
37
|
}
|
|
35
38
|
write(buffer, offset, length, position) {
|
|
36
39
|
return this.rpc('write', buffer, offset, length, position);
|
|
37
40
|
}
|
|
38
41
|
writeSync() {
|
|
39
|
-
|
|
42
|
+
this._throwNoSync('write');
|
|
40
43
|
}
|
|
41
44
|
async read(buffer, offset, length, position) {
|
|
42
45
|
const result = await this.rpc('read', buffer, offset, length, position);
|
|
43
46
|
return result;
|
|
44
47
|
}
|
|
45
48
|
readSync() {
|
|
46
|
-
|
|
49
|
+
this._throwNoSync('read');
|
|
47
50
|
}
|
|
48
51
|
chown(uid, gid) {
|
|
49
52
|
return this.rpc('chown', uid, gid);
|
|
50
53
|
}
|
|
51
54
|
chownSync() {
|
|
52
|
-
|
|
55
|
+
this._throwNoSync('chown');
|
|
53
56
|
}
|
|
54
57
|
chmod(mode) {
|
|
55
58
|
return this.rpc('chmod', mode);
|
|
56
59
|
}
|
|
57
60
|
chmodSync() {
|
|
58
|
-
|
|
61
|
+
this._throwNoSync('chmod');
|
|
59
62
|
}
|
|
60
63
|
utimes(atime, mtime) {
|
|
61
64
|
return this.rpc('utimes', atime, mtime);
|
|
62
65
|
}
|
|
63
66
|
utimesSync() {
|
|
64
|
-
|
|
67
|
+
this._throwNoSync('utimes');
|
|
65
68
|
}
|
|
66
69
|
_setType(type) {
|
|
67
70
|
return this.rpc('_setType', type);
|
|
68
71
|
}
|
|
69
72
|
_setTypeSync() {
|
|
70
|
-
|
|
73
|
+
this._throwNoSync('_setType');
|
|
71
74
|
}
|
|
72
75
|
close() {
|
|
73
76
|
return this.rpc('close');
|
|
74
77
|
}
|
|
75
78
|
closeSync() {
|
|
76
|
-
|
|
79
|
+
this._throwNoSync('close');
|
|
77
80
|
}
|
|
78
81
|
sync() {
|
|
79
82
|
return this.rpc('sync');
|
|
80
83
|
}
|
|
81
84
|
syncSync() {
|
|
82
|
-
|
|
85
|
+
this._throwNoSync('sync');
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
/**
|