@zenfs/core 0.12.2 → 0.12.4
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 -2
- package/dist/backends/index/index.d.ts +2 -1
- package/dist/backends/overlay.d.ts +4 -3
- package/dist/backends/port/fs.d.ts +5 -2
- package/dist/backends/port/fs.js +13 -10
- package/dist/browser.min.js +4 -4
- 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 +2 -1
- package/dist/emulation/promises.d.ts +1 -1
- package/dist/emulation/promises.js +28 -36
- package/dist/emulation/shared.d.ts +2 -2
- package/dist/emulation/shared.js +1 -2
- package/dist/emulation/streams.d.ts +1 -1
- package/dist/emulation/sync.d.ts +1 -1
- package/dist/emulation/sync.js +24 -32
- package/dist/error.d.ts +1 -1
- package/dist/error.js +1 -1
- package/dist/file.d.ts +2 -13
- package/dist/file.js +3 -33
- package/dist/filesystem.d.ts +18 -36
- package/dist/filesystem.js +9 -13
- package/dist/stats.d.ts +1 -1
- 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 +6 -3
- 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 +2 -1
- package/src/emulation/promises.ts +29 -34
- package/src/emulation/shared.ts +4 -4
- package/src/emulation/streams.ts +1 -1
- package/src/emulation/sync.ts +28 -33
- package/src/error.ts +1 -1
- package/src/file.ts +5 -39
- package/src/filesystem.ts +19 -38
- package/src/stats.ts +1 -1
- 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>;
|
|
@@ -19,7 +20,6 @@ declare const IndexFS_base: (abstract new (...args: any[]) => {
|
|
|
19
20
|
linkSync(srcpath: string, dstpath: string, cred: Cred): void;
|
|
20
21
|
sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
|
|
21
22
|
syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
|
|
22
|
-
_type?: number | undefined;
|
|
23
23
|
ready(): Promise<void>;
|
|
24
24
|
stat(path: string, cred: Cred): Promise<Stats>;
|
|
25
25
|
statSync(path: string, cred: Cred): Stats;
|
|
@@ -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
|
*/
|
|
@@ -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>;
|
|
@@ -55,14 +56,16 @@ declare const PortFS_base: (abstract new (...args: any[]) => {
|
|
|
55
56
|
readdirSync(path: string, cred: Cred): string[];
|
|
56
57
|
linkSync(srcpath: string, dstpath: string, cred: Cred): void;
|
|
57
58
|
syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
|
|
58
|
-
_type?: number | undefined;
|
|
59
59
|
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
60
60
|
stat(path: string, cred: Cred): Promise<Stats>;
|
|
61
61
|
openFile(path: string, flag: string, cred: Cred): Promise<File>;
|
|
62
62
|
createFile(path: string, flag: string, mode: number, cred: Cred): Promise<File>;
|
|
63
63
|
unlink(path: string, cred: Cred): Promise<void>;
|
|
64
64
|
rmdir(path: string, cred: Cred): Promise<void>;
|
|
65
|
-
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
|
+
*/
|
|
66
69
|
readdir(path: string, cred: Cred): Promise<string[]>;
|
|
67
70
|
exists(path: string, cred: Cred): Promise<boolean>;
|
|
68
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
|
/**
|