@zenfs/core 1.11.4 → 2.1.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/backends/backend.d.ts +19 -15
- package/dist/backends/backend.js +36 -19
- package/dist/backends/cow.d.ts +20 -30
- package/dist/backends/cow.js +83 -192
- package/dist/backends/fetch.d.ts +1 -0
- package/dist/backends/fetch.js +30 -30
- package/dist/backends/index.d.ts +1 -1
- package/dist/backends/index.js +1 -1
- package/dist/backends/memory.d.ts +5 -7
- package/dist/backends/memory.js +2 -3
- package/dist/backends/passthrough.d.ts +19 -23
- package/dist/backends/passthrough.js +98 -288
- package/dist/backends/port.d.ts +220 -0
- package/dist/backends/port.js +328 -0
- package/dist/backends/single_buffer.d.ts +59 -47
- package/dist/backends/single_buffer.js +468 -219
- package/dist/backends/store/fs.d.ts +25 -35
- package/dist/backends/store/fs.js +276 -315
- package/dist/backends/store/store.d.ts +10 -15
- package/dist/backends/store/store.js +11 -10
- package/dist/config.d.ts +3 -12
- package/dist/config.js +17 -19
- package/dist/context.d.ts +8 -21
- package/dist/context.js +33 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/contexts.d.ts +63 -0
- package/dist/internal/contexts.js +15 -0
- package/dist/internal/credentials.d.ts +2 -11
- package/dist/internal/credentials.js +0 -19
- package/dist/internal/devices.d.ts +18 -80
- package/dist/internal/devices.js +103 -316
- package/dist/internal/error.d.ts +9 -204
- package/dist/internal/error.js +19 -288
- package/dist/internal/file_index.d.ts +1 -1
- package/dist/internal/file_index.js +11 -11
- package/dist/internal/filesystem.d.ts +51 -94
- package/dist/internal/filesystem.js +21 -20
- package/dist/internal/index.d.ts +1 -2
- package/dist/internal/index.js +1 -2
- package/dist/internal/index_fs.d.ts +12 -30
- package/dist/internal/index_fs.js +37 -69
- package/dist/internal/inode.d.ts +140 -24
- package/dist/internal/inode.js +515 -66
- package/dist/mixins/async.js +52 -112
- package/dist/mixins/mutexed.d.ts +19 -18
- package/dist/mixins/mutexed.js +62 -64
- package/dist/mixins/readonly.d.ts +7 -6
- package/dist/mixins/readonly.js +24 -18
- package/dist/mixins/sync.js +8 -8
- package/dist/{vfs/path.d.ts → path.d.ts} +3 -4
- package/dist/{vfs/path.js → path.js} +6 -9
- package/dist/polyfills.js +1 -1
- package/dist/readline.d.ts +134 -0
- package/dist/readline.js +623 -0
- package/dist/utils.d.ts +9 -37
- package/dist/utils.js +17 -85
- package/dist/vfs/acl.d.ts +42 -0
- package/dist/vfs/acl.js +268 -0
- package/dist/vfs/async.d.ts +9 -23
- package/dist/vfs/async.js +25 -27
- package/dist/vfs/config.d.ts +6 -18
- package/dist/vfs/config.js +8 -18
- package/dist/vfs/dir.d.ts +3 -3
- package/dist/vfs/dir.js +12 -12
- package/dist/vfs/file.d.ts +106 -0
- package/dist/vfs/file.js +244 -0
- package/dist/vfs/flags.d.ts +19 -0
- package/dist/vfs/flags.js +62 -0
- package/dist/vfs/index.d.ts +4 -10
- package/dist/vfs/index.js +4 -13
- package/dist/vfs/ioctl.d.ts +88 -0
- package/dist/vfs/ioctl.js +409 -0
- package/dist/vfs/promises.d.ts +81 -19
- package/dist/vfs/promises.js +404 -288
- package/dist/vfs/shared.d.ts +7 -37
- package/dist/vfs/shared.js +29 -85
- package/dist/{stats.d.ts → vfs/stats.d.ts} +14 -28
- package/dist/{stats.js → vfs/stats.js} +11 -66
- package/dist/vfs/streams.d.ts +1 -0
- package/dist/vfs/streams.js +32 -27
- package/dist/vfs/sync.d.ts +3 -3
- package/dist/vfs/sync.js +263 -260
- package/dist/vfs/watchers.d.ts +2 -2
- package/dist/vfs/watchers.js +12 -12
- package/dist/vfs/xattr.d.ts +116 -0
- package/dist/vfs/xattr.js +201 -0
- package/package.json +5 -3
- package/readme.md +1 -1
- package/scripts/test.js +2 -2
- package/tests/assignment.ts +1 -1
- package/tests/backend/config.worker.js +4 -1
- package/tests/backend/fetch.test.ts +3 -0
- package/tests/backend/port.test.ts +19 -33
- package/tests/backend/remote.worker.js +4 -1
- package/tests/backend/single-buffer.test.ts +53 -0
- package/tests/backend/single-buffer.worker.js +30 -0
- package/tests/common/context.test.ts +3 -3
- package/tests/common/handle.test.ts +17 -12
- package/tests/common/mutex.test.ts +9 -9
- package/tests/common/path.test.ts +1 -1
- package/tests/common/readline.test.ts +104 -0
- package/tests/common.ts +4 -19
- package/tests/fetch/fetch.ts +2 -2
- package/tests/fs/append.test.ts +4 -4
- package/tests/fs/directory.test.ts +25 -25
- package/tests/fs/errors.test.ts +15 -19
- package/tests/fs/links.test.ts +4 -3
- package/tests/fs/open.test.ts +4 -21
- package/tests/fs/permissions.test.ts +14 -18
- package/tests/fs/read.test.ts +10 -9
- package/tests/fs/readFile.test.ts +10 -26
- package/tests/fs/rename.test.ts +4 -9
- package/tests/fs/stat.test.ts +8 -8
- package/tests/fs/streams.test.ts +2 -11
- package/tests/fs/times.test.ts +7 -7
- package/tests/fs/truncate.test.ts +8 -36
- package/tests/fs/watch.test.ts +10 -10
- package/tests/fs/write.test.ts +77 -13
- package/tests/fs/xattr.test.ts +85 -0
- package/tests/logs.js +22 -0
- package/tests/setup/context.ts +1 -1
- package/tests/setup/index.ts +3 -3
- package/tests/setup/port.ts +7 -1
- package/dist/backends/port/fs.d.ts +0 -84
- package/dist/backends/port/fs.js +0 -151
- package/dist/backends/port/rpc.d.ts +0 -77
- package/dist/backends/port/rpc.js +0 -100
- package/dist/backends/store/simple.d.ts +0 -20
- package/dist/backends/store/simple.js +0 -13
- package/dist/internal/file.d.ts +0 -359
- package/dist/internal/file.js +0 -751
- package/dist/internal/log.d.ts +0 -133
- package/dist/internal/log.js +0 -218
- package/tests/fs/writeFile.test.ts +0 -70
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import type { Abortable } from 'node:events';
|
|
3
|
+
import type * as readline from 'node:readline';
|
|
4
|
+
interface InterfaceEvents {
|
|
5
|
+
close: [];
|
|
6
|
+
line: [input: string];
|
|
7
|
+
pause: [];
|
|
8
|
+
resume: [];
|
|
9
|
+
SIGCONT: [];
|
|
10
|
+
SIGINT: [];
|
|
11
|
+
SIGTSTP: [];
|
|
12
|
+
history: [history: string[]];
|
|
13
|
+
}
|
|
14
|
+
export declare class Interface extends EventEmitter<InterfaceEvents> implements readline.Interface {
|
|
15
|
+
readonly input: NodeJS.ReadableStream;
|
|
16
|
+
readonly output?: NodeJS.WritableStream | undefined;
|
|
17
|
+
readonly terminal: boolean;
|
|
18
|
+
readonly line: string;
|
|
19
|
+
protected _cursor: number;
|
|
20
|
+
get cursor(): number;
|
|
21
|
+
private _buffer;
|
|
22
|
+
private _closed;
|
|
23
|
+
private _paused;
|
|
24
|
+
private _prompt;
|
|
25
|
+
private _history;
|
|
26
|
+
private _historyIndex;
|
|
27
|
+
private _currentLine;
|
|
28
|
+
constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream | undefined, completer?: readline.Completer | readline.AsyncCompleter, terminal?: boolean);
|
|
29
|
+
private _onData;
|
|
30
|
+
/**
|
|
31
|
+
* Closes the interface and removes all event listeners
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Pauses the input stream
|
|
36
|
+
*/
|
|
37
|
+
pause(): this;
|
|
38
|
+
/**
|
|
39
|
+
* Resumes the input stream
|
|
40
|
+
*/
|
|
41
|
+
resume(): this;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the prompt text
|
|
44
|
+
*/
|
|
45
|
+
setPrompt(prompt: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the current prompt text
|
|
48
|
+
*/
|
|
49
|
+
getPrompt(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Displays the prompt to the user
|
|
52
|
+
*/
|
|
53
|
+
prompt(preserveCursor?: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Writes data to the interface and handles key events
|
|
56
|
+
*/
|
|
57
|
+
write(data: string | Buffer, key?: readline.Key): void;
|
|
58
|
+
private _renderLine;
|
|
59
|
+
/**
|
|
60
|
+
* Asks the user for input with a specified prompt
|
|
61
|
+
*/
|
|
62
|
+
question(query: string, callback: (answer: string) => void): void;
|
|
63
|
+
question(query: string, options: Abortable, callback: (answer: string) => void): void;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the current cursor position
|
|
66
|
+
*/
|
|
67
|
+
getCursorPos(): {
|
|
68
|
+
rows: number;
|
|
69
|
+
cols: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Prepends a listener for the specified event
|
|
73
|
+
*/
|
|
74
|
+
prependListener(event: keyof InterfaceEvents, listener: (...args: any[]) => void): this;
|
|
75
|
+
/**
|
|
76
|
+
* Prepends a one-time listener for the specified event
|
|
77
|
+
*/
|
|
78
|
+
prependOnceListener(event: keyof InterfaceEvents, listener: (...args: any[]) => void): this;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the maximum number of listeners
|
|
81
|
+
*/
|
|
82
|
+
setMaxListeners(): this;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the maximum number of listeners
|
|
85
|
+
*/
|
|
86
|
+
getMaxListeners(): number;
|
|
87
|
+
[Symbol.asyncIterator](): AsyncIteratorObject<string>;
|
|
88
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
89
|
+
rawListeners(event: keyof InterfaceEvents): ((...args: any[]) => void)[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates a readline interface
|
|
93
|
+
* @param input The readable stream to read from
|
|
94
|
+
* @param output The writable stream to write to
|
|
95
|
+
* @param completer The completer function
|
|
96
|
+
* @param terminal Whether to use terminal features
|
|
97
|
+
* @returns A readline interface
|
|
98
|
+
*/
|
|
99
|
+
export declare function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: readline.Completer | readline.AsyncCompleter, terminal?: boolean): Interface;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a readline interface from options
|
|
102
|
+
* @param options The options for the interface
|
|
103
|
+
* @returns A readline interface
|
|
104
|
+
*/
|
|
105
|
+
export declare function createInterface(options: readline.ReadLineOptions): Interface;
|
|
106
|
+
/**
|
|
107
|
+
* Clear the current line in the terminal
|
|
108
|
+
* @param stream The stream to clear the line on
|
|
109
|
+
* @param dir The direction to clear: -1 for left, 1 for right, 0 for entire line
|
|
110
|
+
*/
|
|
111
|
+
export declare function clearLine(stream: NodeJS.WritableStream, dir: number): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Clear the screen down from the current position
|
|
114
|
+
* @param stream The stream to clear the screen on
|
|
115
|
+
*/
|
|
116
|
+
export declare function clearScreenDown(stream: NodeJS.WritableStream): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Move the cursor in the terminal
|
|
119
|
+
* @param stream The stream to move the cursor on
|
|
120
|
+
* @param dx The number of characters to move horizontally
|
|
121
|
+
* @param dy The number of lines to move vertically
|
|
122
|
+
*/
|
|
123
|
+
export declare function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The `readline.emitKeypressEvents()` method causes the given Readable stream to begin emitting `'keypress'` events corresponding to received input.
|
|
126
|
+
*
|
|
127
|
+
* Optionally, interface specifies a `readline.Interface` instance for which autocompletion is disabled when copy-pasted input is detected.
|
|
128
|
+
*
|
|
129
|
+
* If the `stream` is a TTY, then it must be in raw mode.
|
|
130
|
+
*
|
|
131
|
+
* This is automatically called by any readline instance on its `input` if the `input` is a terminal. Closing the `readline` instance does not stop the `input` from emitting `'keypress'` events.
|
|
132
|
+
*/
|
|
133
|
+
export declare function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface | readline.Interface): void;
|
|
134
|
+
export {};
|