@zenfs/core 2.4.0 → 2.4.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/COPYING.md +18 -0
- package/{readme.md → README.md} +16 -74
- package/dist/backends/fetch.js +1 -1
- package/dist/backends/memory.js +1 -1
- package/dist/backends/passthrough.d.ts +1 -2
- package/dist/backends/single_buffer.js +1 -1
- package/dist/backends/store/fs.js +4 -4
- package/dist/config.js +15 -15
- package/dist/context.js +3 -2
- package/dist/index.d.ts +9 -3
- package/dist/index.js +9 -4
- package/dist/internal/contexts.d.ts +5 -4
- package/dist/internal/devices.js +1 -1
- package/dist/internal/error.d.ts +11 -2
- package/dist/internal/error.js +38 -2
- package/dist/internal/file_index.js +1 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +2 -1
- package/dist/internal/index_fs.js +1 -1
- package/dist/internal/inode.d.ts +51 -2
- package/dist/internal/inode.js +18 -2
- package/dist/mixins/shared.js +1 -1
- package/dist/node/async.d.ts +278 -0
- package/dist/node/async.js +518 -0
- package/dist/node/compat.d.ts +4 -0
- package/dist/node/compat.js +6 -0
- package/dist/node/dir.d.ts +78 -0
- package/dist/node/dir.js +150 -0
- package/dist/node/index.d.ts +8 -0
- package/dist/node/index.js +8 -0
- package/dist/{vfs → node}/promises.d.ts +10 -66
- package/dist/{vfs → node}/promises.js +141 -478
- package/dist/{vfs → node}/stats.d.ts +0 -4
- package/dist/{vfs → node}/stats.js +1 -16
- package/dist/{vfs → node}/streams.js +2 -2
- package/dist/node/sync.d.ts +252 -0
- package/dist/node/sync.js +682 -0
- package/dist/node/types.d.ts +21 -0
- package/dist/path.js +3 -25
- package/dist/utils.d.ts +1 -7
- package/dist/utils.js +0 -6
- package/dist/vfs/acl.js +1 -1
- package/dist/vfs/async.d.ts +22 -278
- package/dist/vfs/async.js +212 -501
- package/dist/vfs/dir.d.ts +5 -82
- package/dist/vfs/dir.js +5 -233
- package/dist/vfs/file.d.ts +52 -13
- package/dist/vfs/file.js +167 -25
- package/dist/vfs/flags.js +1 -1
- package/dist/vfs/index.d.ts +2 -5
- package/dist/vfs/index.js +2 -5
- package/dist/vfs/shared.d.ts +25 -1
- package/dist/vfs/shared.js +6 -4
- package/dist/vfs/sync.d.ts +17 -245
- package/dist/vfs/sync.js +129 -773
- package/dist/vfs/watchers.d.ts +1 -1
- package/dist/vfs/watchers.js +2 -2
- package/dist/vfs/xattr.js +1 -1
- package/eslint.shared.js +1 -0
- package/package.json +7 -5
- package/scripts/make-index.js +5 -29
- package/scripts/test.js +59 -51
- package/tests/backend/fetch.test.ts +2 -2
- package/tests/backend/port.test.ts +2 -3
- package/tests/backend/single-buffer.test.ts +1 -1
- package/tests/common/casefold.test.ts +1 -1
- package/tests/common/context.test.ts +11 -4
- package/tests/common/devices.test.ts +3 -3
- package/tests/common/handle.test.ts +4 -3
- package/tests/common/inode.test.ts +2 -2
- package/tests/common/mounts.test.ts +1 -3
- package/tests/common/mutex.test.ts +1 -3
- package/tests/common/path.test.ts +2 -2
- package/tests/common/readline.test.ts +1 -1
- package/tests/common.ts +5 -4
- package/tests/fetch/fetch.ts +1 -1
- package/tests/fs/dir.test.ts +3 -43
- package/tests/fs/directory.test.ts +4 -4
- package/tests/fs/errors.test.ts +2 -2
- package/tests/fs/links.test.ts +1 -1
- package/tests/fs/permissions.test.ts +3 -3
- package/tests/fs/read.test.ts +1 -1
- package/tests/fs/scaling.test.ts +1 -1
- package/tests/fs/stat.test.ts +1 -2
- package/tests/fs/times.test.ts +1 -1
- package/tests/fs/watch.test.ts +3 -2
- package/tests/setup/context.ts +1 -2
- package/tests/setup/cow.ts +1 -1
- package/tests/setup/index.ts +2 -2
- package/tests/setup/port.ts +1 -1
- package/tests/setup/single-buffer.ts +1 -1
- package/tests/setup.ts +4 -3
- package/dist/vfs/types.d.ts +0 -24
- package/tests/assignment.ts +0 -21
- /package/dist/{vfs/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{vfs/constants.js → constants.js} +0 -0
- /package/dist/{readline.d.ts → node/readline.d.ts} +0 -0
- /package/dist/{readline.js → node/readline.js} +0 -0
- /package/dist/{vfs → node}/streams.d.ts +0 -0
- /package/dist/{vfs → node}/types.js +0 -0
package/dist/path.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
2
|
-
/*
|
|
3
|
-
Copyright Joyent, Inc. and other Node contributors.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
|
6
|
-
copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
10
|
-
persons to whom the Software is furnished to do so, subject to the
|
|
11
|
-
following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included
|
|
14
|
-
in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17
|
-
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
19
|
-
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
20
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
22
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
2
|
import { defaultContext } from './internal/contexts.js';
|
|
25
3
|
import { globToRegex } from './utils.js';
|
|
26
4
|
export const sep = '/';
|
|
@@ -124,8 +102,8 @@ export function resolve(...parts) {
|
|
|
124
102
|
export function normalize(path) {
|
|
125
103
|
if (!path.length)
|
|
126
104
|
return '.';
|
|
127
|
-
const isAbsolute = path
|
|
128
|
-
const trailingSeparator = path.
|
|
105
|
+
const isAbsolute = path[0] === '/';
|
|
106
|
+
const trailingSeparator = path.at(-1) === '/';
|
|
129
107
|
// Normalize the path
|
|
130
108
|
path = normalizeString(path, !isAbsolute);
|
|
131
109
|
if (!path.length) {
|
|
@@ -143,7 +121,7 @@ export function isAbsolute(path) {
|
|
|
143
121
|
export function join(...parts) {
|
|
144
122
|
if (!parts.length)
|
|
145
123
|
return '.';
|
|
146
|
-
const joined = parts.join('/');
|
|
124
|
+
const joined = parts.filter(p => p).join('/');
|
|
147
125
|
if (!joined?.length)
|
|
148
126
|
return '.';
|
|
149
127
|
return normalize(joined);
|
package/dist/utils.d.ts
CHANGED
|
@@ -27,13 +27,7 @@ export declare function normalizeMode(mode: unknown, def?: number): number;
|
|
|
27
27
|
* Normalizes a time
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
|
-
export declare function normalizeTime(time:
|
|
31
|
-
/**
|
|
32
|
-
* TypeScript is dumb, so we need to assert the type of a value sometimes.
|
|
33
|
-
* For example, after calling `normalizePath`, TS still thinks the type is `PathLike` and not `string`.
|
|
34
|
-
* @internal @hidden
|
|
35
|
-
*/
|
|
36
|
-
export declare function __assertType<T>(value: unknown): asserts value is T;
|
|
30
|
+
export declare function normalizeTime(time: fs.TimeLike): number;
|
|
37
31
|
/**
|
|
38
32
|
* Normalizes a path
|
|
39
33
|
* @internal
|
package/dist/utils.js
CHANGED
|
@@ -48,12 +48,6 @@ export function normalizeTime(time) {
|
|
|
48
48
|
throw withErrno('EINVAL', 'Invalid time.');
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* TypeScript is dumb, so we need to assert the type of a value sometimes.
|
|
53
|
-
* For example, after calling `normalizePath`, TS still thinks the type is `PathLike` and not `string`.
|
|
54
|
-
* @internal @hidden
|
|
55
|
-
*/
|
|
56
|
-
export function __assertType(value) { }
|
|
57
51
|
/**
|
|
58
52
|
* Normalizes a path
|
|
59
53
|
* @internal
|
package/dist/vfs/acl.js
CHANGED
|
@@ -46,7 +46,7 @@ import { $from, struct, types as t } from 'memium/decorators';
|
|
|
46
46
|
import { BufferView } from 'utilium/buffer.js';
|
|
47
47
|
import { defaultContext } from '../internal/contexts.js';
|
|
48
48
|
import { Attributes } from '../internal/inode.js';
|
|
49
|
-
import { R_OK, S_IRWXG, S_IRWXO, S_IRWXU, W_OK, X_OK } from '
|
|
49
|
+
import { R_OK, S_IRWXG, S_IRWXO, S_IRWXU, W_OK, X_OK } from '../constants.js';
|
|
50
50
|
import * as xattr from './xattr.js';
|
|
51
51
|
const version = 2;
|
|
52
52
|
export var Type;
|
package/dist/vfs/async.d.ts
CHANGED
|
@@ -1,278 +1,22 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { V_Context } from '../
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function stat(this: V_Context, path: fs.PathLike, options: {
|
|
24
|
-
bigint?: false;
|
|
25
|
-
}, callback: Callback<[Stats]>): void;
|
|
26
|
-
export declare function stat(this: V_Context, path: fs.PathLike, options: {
|
|
27
|
-
bigint: true;
|
|
28
|
-
}, callback: Callback<[BigIntStats]>): void;
|
|
29
|
-
export declare function stat(this: V_Context, path: fs.PathLike, options: fs.StatOptions, callback: Callback<[Stats] | [BigIntStats]>): void;
|
|
30
|
-
/**
|
|
31
|
-
* Asynchronous `lstat`.
|
|
32
|
-
* `lstat()` is identical to `stat()`, except that if path is a symbolic link,
|
|
33
|
-
* then the link itself is stat-ed, not the file that it refers to.
|
|
34
|
-
*/
|
|
35
|
-
export declare function lstat(this: V_Context, path: fs.PathLike, callback: Callback<[Stats]>): void;
|
|
36
|
-
export declare function lstat(this: V_Context, path: fs.PathLike, options: fs.StatOptions & {
|
|
37
|
-
bigint?: false;
|
|
38
|
-
}, callback: Callback<[Stats]>): void;
|
|
39
|
-
export declare function lstat(this: V_Context, path: fs.PathLike, options: fs.StatOptions & {
|
|
40
|
-
bigint: true;
|
|
41
|
-
}, callback: Callback<[BigIntStats]>): void;
|
|
42
|
-
export declare function lstat(this: V_Context, path: fs.PathLike, options: fs.StatOptions, callback: Callback<[Stats | BigIntStats]>): void;
|
|
43
|
-
export declare function truncate(this: V_Context, path: fs.PathLike, cb?: Callback): void;
|
|
44
|
-
export declare function truncate(this: V_Context, path: fs.PathLike, len: number, cb?: Callback): void;
|
|
45
|
-
export declare function unlink(this: V_Context, path: fs.PathLike, cb?: Callback): void;
|
|
46
|
-
/**
|
|
47
|
-
* Asynchronous file open.
|
|
48
|
-
* Exclusive mode ensures that path is newly created.
|
|
49
|
-
* Mode defaults to `0644`
|
|
50
|
-
*
|
|
51
|
-
* @see https://nodejs.org/api/fs.html#fsopenpath-flags-mode-callback
|
|
52
|
-
* @param flags {@link https://nodejs.org/api/fs.html#file-system-flags}
|
|
53
|
-
*/
|
|
54
|
-
export declare function open(this: V_Context, path: fs.PathLike, flag: fs.OpenMode, cb?: Callback<[number]>): void;
|
|
55
|
-
export declare function open(this: V_Context, path: fs.PathLike, flag: fs.OpenMode, mode: number | string, cb?: Callback<[number]>): void;
|
|
56
|
-
/**
|
|
57
|
-
* Asynchronously reads the entire contents of a file.
|
|
58
|
-
* @option encoding The string encoding for the file contents. Defaults to `null`.
|
|
59
|
-
* @option flag Defaults to `'r'`.
|
|
60
|
-
* @param cb If no encoding is specified, then the raw buffer is returned.
|
|
61
|
-
*/
|
|
62
|
-
export declare function readFile(this: V_Context, filename: fs.PathLike, cb: Callback<[Uint8Array]>): void;
|
|
63
|
-
export declare function readFile(this: V_Context, filename: fs.PathLike, options: {
|
|
64
|
-
flag?: string;
|
|
65
|
-
}, callback?: Callback<[Uint8Array]>): void;
|
|
66
|
-
export declare function readFile(this: V_Context, filename: fs.PathLike, options: {
|
|
67
|
-
encoding: BufferEncoding;
|
|
68
|
-
flag?: string;
|
|
69
|
-
} | BufferEncoding, cb: Callback<[string]>): void;
|
|
70
|
-
/**
|
|
71
|
-
* Asynchronously writes data to a file, replacing the file if it already
|
|
72
|
-
* exists.
|
|
73
|
-
*
|
|
74
|
-
* The encoding option is ignored if data is a buffer.
|
|
75
|
-
*
|
|
76
|
-
* @option encoding Defaults to `'utf8'`.
|
|
77
|
-
* @option mode Defaults to `0644`.
|
|
78
|
-
* @option flag Defaults to `'w'`.
|
|
79
|
-
*/
|
|
80
|
-
export declare function writeFile(this: V_Context, filename: fs.PathLike, data: FileContents, cb?: Callback): void;
|
|
81
|
-
export declare function writeFile(this: V_Context, filename: fs.PathLike, data: FileContents, encoding?: BufferEncoding, cb?: Callback): void;
|
|
82
|
-
export declare function writeFile(this: V_Context, filename: fs.PathLike, data: FileContents, options?: fs.WriteFileOptions, cb?: Callback): void;
|
|
83
|
-
/**
|
|
84
|
-
* Asynchronously append data to a file, creating the file if it not yet
|
|
85
|
-
* exists.
|
|
86
|
-
*
|
|
87
|
-
* @option encoding Defaults to `'utf8'`.
|
|
88
|
-
* @option mode Defaults to `0644`.
|
|
89
|
-
* @option flag Defaults to `'a'`.
|
|
90
|
-
*/
|
|
91
|
-
export declare function appendFile(this: V_Context, filename: fs.PathLike, data: FileContents, cb?: Callback): void;
|
|
92
|
-
export declare function appendFile(this: V_Context, filename: fs.PathLike, data: FileContents, options?: fs.EncodingOption & {
|
|
93
|
-
mode?: fs.Mode;
|
|
94
|
-
flag?: fs.OpenMode;
|
|
95
|
-
}, cb?: Callback): void;
|
|
96
|
-
export declare function appendFile(this: V_Context, filename: fs.PathLike, data: FileContents, encoding?: BufferEncoding, cb?: Callback): void;
|
|
97
|
-
/**
|
|
98
|
-
* Asynchronous `fstat`.
|
|
99
|
-
* `fstat()` is identical to `stat()`, except that the file to be stat-ed is specified by the file descriptor `fd`.
|
|
100
|
-
*/
|
|
101
|
-
export declare function fstat(this: V_Context, fd: number, cb: Callback<[Stats]>): void;
|
|
102
|
-
export declare function fstat(this: V_Context, fd: number, options: fs.StatOptions & {
|
|
103
|
-
bigint?: false;
|
|
104
|
-
}, cb: Callback<[Stats]>): void;
|
|
105
|
-
export declare function fstat(this: V_Context, fd: number, options: fs.StatOptions & {
|
|
106
|
-
bigint: true;
|
|
107
|
-
}, cb: Callback<[BigIntStats]>): void;
|
|
108
|
-
export declare function close(this: V_Context, fd: number, cb?: Callback): void;
|
|
109
|
-
export declare function ftruncate(this: V_Context, fd: number, cb?: Callback): void;
|
|
110
|
-
export declare function ftruncate(this: V_Context, fd: number, len?: number, cb?: Callback): void;
|
|
111
|
-
export declare function fsync(this: V_Context, fd: number, cb?: Callback): void;
|
|
112
|
-
export declare function fdatasync(this: V_Context, fd: number, cb?: Callback): void;
|
|
113
|
-
/**
|
|
114
|
-
* Write buffer to the file specified by `fd`.
|
|
115
|
-
* Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback.
|
|
116
|
-
* @param buffer Uint8Array containing the data to write to the file.
|
|
117
|
-
* @param offset Offset in the buffer to start reading data from.
|
|
118
|
-
* @param length The amount of bytes to write to the file.
|
|
119
|
-
* @param position Offset from the beginning of the file where this data should be written.
|
|
120
|
-
* If position is null, the data will be written at the current position.
|
|
121
|
-
* @param cb The number specifies the number of bytes written into the file.
|
|
122
|
-
*/
|
|
123
|
-
export declare function write(this: V_Context, fd: number, buffer: Uint8Array, offset: number, length: number, cb?: Callback<[number, Uint8Array]>): void;
|
|
124
|
-
export declare function write(this: V_Context, fd: number, buffer: Uint8Array, offset: number, length: number, position?: number, cb?: Callback<[number, Uint8Array]>): void;
|
|
125
|
-
export declare function write(this: V_Context, fd: number, data: FileContents, cb?: Callback<[number, string]>): void;
|
|
126
|
-
export declare function write(this: V_Context, fd: number, data: FileContents, position?: number, cb?: Callback<[number, string]>): void;
|
|
127
|
-
export declare function write(this: V_Context, fd: number, data: FileContents, position: number | null, encoding: BufferEncoding, cb?: Callback<[number, string]>): void;
|
|
128
|
-
/**
|
|
129
|
-
* Read data from the file specified by `fd`.
|
|
130
|
-
* @param buffer The buffer that the data will be written to.
|
|
131
|
-
* @param offset The offset within the buffer where writing will start.
|
|
132
|
-
* @param length An integer specifying the number of bytes to read.
|
|
133
|
-
* @param position An integer specifying where to begin reading from in the file.
|
|
134
|
-
* If position is null, data will be read from the current file position.
|
|
135
|
-
* @param cb The number is the number of bytes read
|
|
136
|
-
*/
|
|
137
|
-
export declare function read(this: V_Context, fd: number, buffer: Uint8Array, offset: number, length: number, position?: number, cb?: Callback<[number, Uint8Array]>): void;
|
|
138
|
-
export declare function fchown(this: V_Context, fd: number, uid: number, gid: number, cb?: Callback): void;
|
|
139
|
-
export declare function fchmod(this: V_Context, fd: number, mode: string | number, cb: Callback): void;
|
|
140
|
-
/**
|
|
141
|
-
* Change the file timestamps of a file referenced by the supplied file descriptor.
|
|
142
|
-
*/
|
|
143
|
-
export declare function futimes(this: V_Context, fd: number, atime: number | Date, mtime: number | Date, cb?: Callback): void;
|
|
144
|
-
export declare function rmdir(this: V_Context, path: fs.PathLike, cb?: Callback): void;
|
|
145
|
-
/**
|
|
146
|
-
* Asynchronous `mkdir`.
|
|
147
|
-
* @param mode defaults to `0777`
|
|
148
|
-
*/
|
|
149
|
-
export declare function mkdir(this: V_Context, path: fs.PathLike, mode?: fs.Mode, cb?: Callback): void;
|
|
150
|
-
/**
|
|
151
|
-
* Asynchronous `readdir`. Reads the contents of a directory.
|
|
152
|
-
* The callback gets two arguments `(err, files)` where `files` is an array of
|
|
153
|
-
* the names of the files in the directory excluding `'.'` and `'..'`.
|
|
154
|
-
*/
|
|
155
|
-
export declare function readdir(this: V_Context, path: fs.PathLike, cb: Callback<[string[]]>): void;
|
|
156
|
-
export declare function readdir(this: V_Context, path: fs.PathLike, options: {
|
|
157
|
-
withFileTypes?: false;
|
|
158
|
-
}, cb: Callback<[string[]]>): void;
|
|
159
|
-
export declare function readdir(this: V_Context, path: fs.PathLike, options: {
|
|
160
|
-
withFileTypes: true;
|
|
161
|
-
}, cb: Callback<[Dirent[]]>): void;
|
|
162
|
-
export declare function link(this: V_Context, existing: fs.PathLike, newpath: fs.PathLike, cb?: Callback): void;
|
|
163
|
-
/**
|
|
164
|
-
* Asynchronous `symlink`.
|
|
165
|
-
* @param target target path
|
|
166
|
-
* @param path link path
|
|
167
|
-
* Type defaults to file
|
|
168
|
-
*/
|
|
169
|
-
export declare function symlink(this: V_Context, target: fs.PathLike, path: fs.PathLike, cb?: Callback): void;
|
|
170
|
-
export declare function symlink(this: V_Context, target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type, cb?: Callback): void;
|
|
171
|
-
export declare function readlink(this: V_Context, path: fs.PathLike, callback: Callback<[string]>): void;
|
|
172
|
-
export declare function readlink(this: V_Context, path: fs.PathLike, options: fs.BufferEncodingOption, callback: Callback<[Uint8Array]>): void;
|
|
173
|
-
export declare function readlink(this: V_Context, path: fs.PathLike, options: fs.EncodingOption, callback: Callback<[string | Uint8Array]>): void;
|
|
174
|
-
export declare function readlink(this: V_Context, path: fs.PathLike, options: fs.EncodingOption, callback: Callback<[string]>): void;
|
|
175
|
-
export declare function chown(this: V_Context, path: fs.PathLike, uid: number, gid: number, cb?: Callback): void;
|
|
176
|
-
export declare function lchown(this: V_Context, path: fs.PathLike, uid: number, gid: number, cb?: Callback): void;
|
|
177
|
-
export declare function chmod(this: V_Context, path: fs.PathLike, mode: number | string, cb?: Callback): void;
|
|
178
|
-
export declare function lchmod(this: V_Context, path: fs.PathLike, mode: number | string, cb?: Callback): void;
|
|
179
|
-
/**
|
|
180
|
-
* Change file timestamps of the file referenced by the supplied path.
|
|
181
|
-
*/
|
|
182
|
-
export declare function utimes(this: V_Context, path: fs.PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
|
|
183
|
-
/**
|
|
184
|
-
* Change file timestamps of the file referenced by the supplied path.
|
|
185
|
-
*/
|
|
186
|
-
export declare function lutimes(this: V_Context, path: fs.PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
|
|
187
|
-
/**
|
|
188
|
-
* Asynchronous `realpath`. The callback gets two arguments
|
|
189
|
-
* `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths.
|
|
190
|
-
*/
|
|
191
|
-
export declare function realpath(this: V_Context, path: fs.PathLike, cb?: Callback<[string]>): void;
|
|
192
|
-
export declare function realpath(this: V_Context, path: fs.PathLike, options: fs.EncodingOption, cb: Callback<[string]>): void;
|
|
193
|
-
export declare function access(this: V_Context, path: fs.PathLike, cb: Callback): void;
|
|
194
|
-
export declare function access(this: V_Context, path: fs.PathLike, mode: number, cb: Callback): void;
|
|
195
|
-
/**
|
|
196
|
-
* Watch for changes on a file. The callback listener will be called each time the file is accessed.
|
|
197
|
-
*
|
|
198
|
-
* The `options` argument may be omitted. If provided, it should be an object with a `persistent` boolean and an `interval` number specifying the polling interval in milliseconds.
|
|
199
|
-
*
|
|
200
|
-
* When a change is detected, the `listener` callback is called with the current and previous `Stats` objects.
|
|
201
|
-
*
|
|
202
|
-
* @param path The path to the file to watch.
|
|
203
|
-
* @param options Optional options object specifying `persistent` and `interval`.
|
|
204
|
-
* @param listener The callback listener to be called when the file changes.
|
|
205
|
-
*/
|
|
206
|
-
export declare function watchFile(this: V_Context, path: fs.PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
|
207
|
-
export declare function watchFile(this: V_Context, path: fs.PathLike, options: {
|
|
208
|
-
persistent?: boolean;
|
|
209
|
-
interval?: number;
|
|
210
|
-
}, listener: (curr: Stats, prev: Stats) => void): void;
|
|
211
|
-
/**
|
|
212
|
-
* Stop watching for changes on a file.
|
|
213
|
-
*
|
|
214
|
-
* If the `listener` is specified, only that particular listener is removed.
|
|
215
|
-
* If no `listener` is specified, all listeners are removed, and the file is no longer watched.
|
|
216
|
-
*
|
|
217
|
-
* @param path The path to the file to stop watching.
|
|
218
|
-
* @param listener Optional listener to remove.
|
|
219
|
-
*/
|
|
220
|
-
export declare function unwatchFile(this: V_Context, path: fs.PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
221
|
-
export declare function watch(this: V_Context, path: fs.PathLike, listener?: (event: string, filename: string) => any): FSWatcher;
|
|
222
|
-
export declare function watch(this: V_Context, path: fs.PathLike, options: {
|
|
223
|
-
persistent?: boolean;
|
|
224
|
-
}, listener?: (event: string, filename: string) => any): FSWatcher;
|
|
225
|
-
/**
|
|
226
|
-
* Opens a file in read mode and creates a Node.js-like ReadStream.
|
|
227
|
-
*
|
|
228
|
-
* @param path The path to the file to be opened.
|
|
229
|
-
* @param options Options for the ReadStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
|
|
230
|
-
* @returns A ReadStream object for interacting with the file's contents.
|
|
231
|
-
*/
|
|
232
|
-
export declare function createReadStream(this: V_Context, path: fs.PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
|
|
233
|
-
/**
|
|
234
|
-
* Opens a file in write mode and creates a Node.js-like WriteStream.
|
|
235
|
-
*
|
|
236
|
-
* @param path The path to the file to be opened.
|
|
237
|
-
* @param options Options for the WriteStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
|
|
238
|
-
* @returns A WriteStream object for writing to the file.
|
|
239
|
-
*/
|
|
240
|
-
export declare function createWriteStream(this: V_Context, path: fs.PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
|
|
241
|
-
export declare function rm(this: V_Context, path: fs.PathLike, callback: Callback): void;
|
|
242
|
-
export declare function rm(this: V_Context, path: fs.PathLike, options: fs.RmOptions, callback: Callback): void;
|
|
243
|
-
/**
|
|
244
|
-
* Asynchronously creates a unique temporary directory.
|
|
245
|
-
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
246
|
-
*/
|
|
247
|
-
export declare function mkdtemp(this: V_Context, prefix: string, callback: Callback<[string]>): void;
|
|
248
|
-
export declare function mkdtemp(this: V_Context, prefix: string, options: fs.EncodingOption, callback: Callback<[string]>): void;
|
|
249
|
-
export declare function mkdtemp(this: V_Context, prefix: string, options: fs.BufferEncodingOption, callback: Callback<[Buffer]>): void;
|
|
250
|
-
export declare function copyFile(this: V_Context, src: fs.PathLike, dest: fs.PathLike, callback: Callback): void;
|
|
251
|
-
export declare function copyFile(this: V_Context, src: fs.PathLike, dest: fs.PathLike, flags: number, callback: Callback): void;
|
|
252
|
-
type readvCb = Callback<[number, NodeJS.ArrayBufferView[]]>;
|
|
253
|
-
export declare function readv(this: V_Context, fd: number, buffers: NodeJS.ArrayBufferView[], cb: readvCb): void;
|
|
254
|
-
export declare function readv(this: V_Context, fd: number, buffers: NodeJS.ArrayBufferView[], position: number, cb: readvCb): void;
|
|
255
|
-
type writevCb = Callback<[number, NodeJS.ArrayBufferView[]]>;
|
|
256
|
-
export declare function writev(this: V_Context, fd: number, buffers: Uint8Array[], cb: writevCb): void;
|
|
257
|
-
export declare function writev(this: V_Context, fd: number, buffers: Uint8Array[], position: number, cb: writevCb): void;
|
|
258
|
-
export declare function opendir(this: V_Context, path: fs.PathLike, cb: Callback<[Dir]>): void;
|
|
259
|
-
export declare function opendir(this: V_Context, path: fs.PathLike, options: fs.OpenDirOptions, cb: Callback<[Dir]>): void;
|
|
260
|
-
export declare function cp(this: V_Context, source: fs.PathLike, destination: fs.PathLike, callback: Callback): void;
|
|
261
|
-
export declare function cp(this: V_Context, source: fs.PathLike, destination: fs.PathLike, opts: fs.CopyOptions, callback: Callback): void;
|
|
262
|
-
export declare function statfs(this: V_Context, path: fs.PathLike, callback: Callback<[fs.StatsFs]>): void;
|
|
263
|
-
export declare function statfs(this: V_Context, path: fs.PathLike, options: fs.StatFsOptions & {
|
|
264
|
-
bigint?: false;
|
|
265
|
-
}, callback: Callback<[fs.StatsFs]>): void;
|
|
266
|
-
export declare function statfs(this: V_Context, path: fs.PathLike, options: fs.StatFsOptions & {
|
|
267
|
-
bigint: true;
|
|
268
|
-
}, callback: Callback<[fs.BigIntStatsFs]>): void;
|
|
269
|
-
export declare function openAsBlob(this: V_Context, path: fs.PathLike, options?: fs.OpenAsBlobOptions): Promise<Blob>;
|
|
270
|
-
type GlobCallback<Args extends unknown[]> = (e: Exception | null, ...args: Args) => unknown;
|
|
271
|
-
/**
|
|
272
|
-
* Retrieves the files matching the specified pattern.
|
|
273
|
-
*/
|
|
274
|
-
export declare function glob(this: V_Context, pattern: string | readonly string[], callback: GlobCallback<[string[]]>): void;
|
|
275
|
-
export declare function glob(this: V_Context, pattern: string | readonly string[], options: fs.GlobOptionsWithFileTypes, callback: GlobCallback<[Dirent[]]>): void;
|
|
276
|
-
export declare function glob(this: V_Context, pattern: string | readonly string[], options: fs.GlobOptionsWithoutFileTypes, callback: GlobCallback<[string[]]>): void;
|
|
277
|
-
export declare function glob(this: V_Context, pattern: string | readonly string[], options: fs.GlobOptions, callback: GlobCallback<[Dirent[] | string[]]>): void;
|
|
278
|
-
export {};
|
|
1
|
+
import type { PathLike } from 'node:fs';
|
|
2
|
+
import type { V_Context } from '../internal/contexts.js';
|
|
3
|
+
import type { MkdirOptions, OpenOptions, ReaddirOptions, ResolvedPath } from './shared.js';
|
|
4
|
+
import { type ExceptionExtra } from 'kerium';
|
|
5
|
+
import { Dirent } from './dir.js';
|
|
6
|
+
import { Handle } from './file.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the mount and real path for a path.
|
|
9
|
+
* Additionally, any stats fetched will be returned for de-duplication
|
|
10
|
+
* @internal @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolve($: V_Context, path: string, preserveSymlinks?: boolean, extra?: ExceptionExtra): Promise<ResolvedPath>;
|
|
13
|
+
/**
|
|
14
|
+
* Opens a file. This helper handles the complexity of file flags.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function open($: V_Context, path: PathLike, opt: OpenOptions): Promise<Handle>;
|
|
18
|
+
export declare function readlink(this: V_Context, path: PathLike): Promise<string>;
|
|
19
|
+
export declare function mkdir(this: V_Context, path: PathLike, options?: MkdirOptions): Promise<string | void>;
|
|
20
|
+
export declare function readdir(this: V_Context, path: PathLike, options?: ReaddirOptions): Promise<Dirent[]>;
|
|
21
|
+
export declare function rename(this: V_Context, oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
22
|
+
export declare function link(this: V_Context, target: PathLike, link: PathLike): Promise<void>;
|