@zenfs/core 2.4.1 → 2.4.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/COPYING.md +24 -0
- package/{readme.md → README.md} +16 -74
- package/dist/backends/backend.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/backends/single_buffer.js +27 -24
- 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/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 +48 -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
|
@@ -150,10 +150,6 @@ export declare abstract class StatsCommon<T extends number | bigint> implements
|
|
|
150
150
|
get ctimeNs(): bigint;
|
|
151
151
|
get birthtimeNs(): bigint;
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
154
|
-
* @hidden @internal
|
|
155
|
-
*/
|
|
156
|
-
export declare function _chown(stats: Partial<StatsLike<number>>, uid: number, gid: number): boolean;
|
|
157
153
|
/**
|
|
158
154
|
* Implementation of Node's `Stats`.
|
|
159
155
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pick } from 'utilium';
|
|
2
2
|
import { _inode_fields, hasAccess } from '../internal/inode.js';
|
|
3
|
-
import * as c from '
|
|
3
|
+
import * as c from '../constants.js';
|
|
4
4
|
const n1000 = BigInt(1000);
|
|
5
5
|
/**
|
|
6
6
|
* Provides information about a particular entry in the file system.
|
|
@@ -168,21 +168,6 @@ export class StatsCommon {
|
|
|
168
168
|
return BigInt(this.birthtimeMs) * n1000;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
/**
|
|
172
|
-
* @hidden @internal
|
|
173
|
-
*/
|
|
174
|
-
export function _chown(stats, uid, gid) {
|
|
175
|
-
let valid = true;
|
|
176
|
-
if (!isNaN(uid) && uid >= 0 && uid < c.size_max)
|
|
177
|
-
stats.uid = uid;
|
|
178
|
-
else
|
|
179
|
-
valid = false;
|
|
180
|
-
if (!isNaN(gid) && gid >= 0 && gid < c.size_max)
|
|
181
|
-
stats.gid = gid;
|
|
182
|
-
else
|
|
183
|
-
valid = false;
|
|
184
|
-
return valid;
|
|
185
|
-
}
|
|
186
171
|
/**
|
|
187
172
|
* Implementation of Node's `Stats`.
|
|
188
173
|
*
|
|
@@ -14,7 +14,7 @@ export class ReadStream extends Readable {
|
|
|
14
14
|
super({ ...opts, encoding: opts.encoding ?? undefined });
|
|
15
15
|
this.ready = Promise.resolve(handleOrPromise)
|
|
16
16
|
.then(handle => {
|
|
17
|
-
this._path = handle.path;
|
|
17
|
+
this._path = handle['vfs'].path;
|
|
18
18
|
const internal = handle.readableWebStream({ start: opts.start, end: opts.end });
|
|
19
19
|
this.reader = internal.getReader();
|
|
20
20
|
this.pending = false;
|
|
@@ -74,7 +74,7 @@ export class WriteStream extends Writable {
|
|
|
74
74
|
super(opts);
|
|
75
75
|
this.ready = Promise.resolve(handleOrPromise)
|
|
76
76
|
.then(handle => {
|
|
77
|
-
this._path = handle.path;
|
|
77
|
+
this._path = handle['vfs'].path;
|
|
78
78
|
const internal = handle.writableWebStream({ start: opts.start });
|
|
79
79
|
this.writer = internal.getWriter();
|
|
80
80
|
this.pending = false;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type * as fs from 'node:fs';
|
|
2
|
+
import type { V_Context } from '../context.js';
|
|
3
|
+
import type { FileContents } from '../vfs/shared.js';
|
|
4
|
+
import type { NodeReaddirOptions } from './types.js';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
6
|
+
import { Dir, Dirent } from './dir.js';
|
|
7
|
+
import { BigIntStats, Stats } from './stats.js';
|
|
8
|
+
export declare function renameSync(this: V_Context, oldPath: fs.PathLike, newPath: fs.PathLike): void;
|
|
9
|
+
/**
|
|
10
|
+
* Test whether or not `path` exists by checking with the file system.
|
|
11
|
+
*/
|
|
12
|
+
export declare function existsSync(this: V_Context, path: fs.PathLike): boolean;
|
|
13
|
+
export declare function statSync(this: V_Context, path: fs.PathLike, options?: {
|
|
14
|
+
bigint?: boolean;
|
|
15
|
+
}): Stats;
|
|
16
|
+
export declare function statSync(this: V_Context, path: fs.PathLike, options: {
|
|
17
|
+
bigint: true;
|
|
18
|
+
}): BigIntStats;
|
|
19
|
+
/**
|
|
20
|
+
* Synchronous `lstat`.
|
|
21
|
+
* `lstat()` is identical to `stat()`, except that if path is a symbolic link,
|
|
22
|
+
* then the link itself is stat-ed, not the file that it refers to.
|
|
23
|
+
*/
|
|
24
|
+
export declare function lstatSync(this: V_Context, path: fs.PathLike, options?: {
|
|
25
|
+
bigint?: boolean;
|
|
26
|
+
}): Stats;
|
|
27
|
+
export declare function lstatSync(this: V_Context, path: fs.PathLike, options: {
|
|
28
|
+
bigint: true;
|
|
29
|
+
}): BigIntStats;
|
|
30
|
+
export declare function truncateSync(this: V_Context, path: fs.PathLike, len?: number | null): void;
|
|
31
|
+
export declare function unlinkSync(this: V_Context, path: fs.PathLike): void;
|
|
32
|
+
/**
|
|
33
|
+
* Synchronous file open.
|
|
34
|
+
* @see https://nodejs.org/api/fs.html#fsopensyncpath-flags-mode
|
|
35
|
+
* @param flag {@link https://nodejs.org/api/fs.html#file-system-flags}
|
|
36
|
+
*/
|
|
37
|
+
export declare function openSync(this: V_Context, path: fs.PathLike, flag: fs.OpenMode, mode?: fs.Mode | null): number;
|
|
38
|
+
/**
|
|
39
|
+
* Opens a file or symlink
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare function lopenSync(this: V_Context, path: fs.PathLike, flag: string, mode?: fs.Mode | null): number;
|
|
43
|
+
/**
|
|
44
|
+
* Synchronously reads the entire contents of a file.
|
|
45
|
+
* @option encoding The string encoding for the file contents. Defaults to `null`.
|
|
46
|
+
* @option flag Defaults to `'r'`.
|
|
47
|
+
* @returns file contents
|
|
48
|
+
*/
|
|
49
|
+
export declare function readFileSync(this: V_Context, path: fs.PathOrFileDescriptor, options?: {
|
|
50
|
+
flag?: string;
|
|
51
|
+
} | null): NonSharedBuffer;
|
|
52
|
+
export declare function readFileSync(this: V_Context, path: fs.PathOrFileDescriptor, options?: (fs.EncodingOption & {
|
|
53
|
+
flag?: string;
|
|
54
|
+
}) | BufferEncoding | null): string;
|
|
55
|
+
/**
|
|
56
|
+
* Synchronously writes data to a file, replacing the file if it already exists.
|
|
57
|
+
*
|
|
58
|
+
* The encoding option is ignored if data is a buffer.
|
|
59
|
+
* @option encoding Defaults to `'utf8'`.
|
|
60
|
+
* @option mode Defaults to `0644`.
|
|
61
|
+
* @option flag Defaults to `'w'`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function writeFileSync(this: V_Context, path: fs.PathOrFileDescriptor, data: FileContents, options?: fs.WriteFileOptions): void;
|
|
64
|
+
export declare function writeFileSync(this: V_Context, path: fs.PathOrFileDescriptor, data: FileContents, encoding?: BufferEncoding): void;
|
|
65
|
+
/**
|
|
66
|
+
* Asynchronously append data to a file, creating the file if it not yet exists.
|
|
67
|
+
* @option encoding Defaults to `'utf8'`.
|
|
68
|
+
* @option mode Defaults to `0644`.
|
|
69
|
+
* @option flag Defaults to `'a+'`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function appendFileSync(this: V_Context, filename: fs.PathOrFileDescriptor, data: FileContents, _options?: fs.WriteFileOptions): void;
|
|
72
|
+
/**
|
|
73
|
+
* Synchronous `fstat`.
|
|
74
|
+
* `fstat()` is identical to `stat()`, except that the file to be stat-ed is
|
|
75
|
+
* specified by the file descriptor `fd`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function fstatSync(this: V_Context, fd: number, options?: {
|
|
78
|
+
bigint?: boolean;
|
|
79
|
+
}): Stats;
|
|
80
|
+
export declare function fstatSync(this: V_Context, fd: number, options: {
|
|
81
|
+
bigint: true;
|
|
82
|
+
}): BigIntStats;
|
|
83
|
+
export declare function closeSync(this: V_Context, fd: number): void;
|
|
84
|
+
export declare function ftruncateSync(this: V_Context, fd: number, len?: number | null): void;
|
|
85
|
+
export declare function fsyncSync(this: V_Context, fd: number): void;
|
|
86
|
+
export declare function fdatasyncSync(this: V_Context, fd: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* Write buffer to the file specified by `fd`.
|
|
89
|
+
* @param data Uint8Array containing the data to write to the file.
|
|
90
|
+
* @param offset Offset in the buffer to start reading data from.
|
|
91
|
+
* @param length The amount of bytes to write to the file.
|
|
92
|
+
* @param position Offset from the beginning of the file where this data should be written.
|
|
93
|
+
* If position is null, the data will be written at the current position.
|
|
94
|
+
*/
|
|
95
|
+
export declare function writeSync(this: V_Context, fd: number, data: ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
|
|
96
|
+
export declare function writeSync(this: V_Context, fd: number, data: string, position?: number | null, encoding?: BufferEncoding | null): number;
|
|
97
|
+
export declare function readSync(this: V_Context, fd: number, buffer: ArrayBufferView, options?: fs.ReadSyncOptions): number;
|
|
98
|
+
export declare function readSync(this: V_Context, fd: number, buffer: ArrayBufferView, offset: number, length: number, position?: fs.ReadPosition | null): number;
|
|
99
|
+
export declare function fchownSync(this: V_Context, fd: number, uid: number, gid: number): void;
|
|
100
|
+
export declare function fchmodSync(this: V_Context, fd: number, mode: number | string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Change the file timestamps of a file referenced by the supplied file descriptor.
|
|
103
|
+
*/
|
|
104
|
+
export declare function futimesSync(this: V_Context, fd: number, atime: fs.TimeLike, mtime: fs.TimeLike): void;
|
|
105
|
+
export declare function rmdirSync(this: V_Context, path: fs.PathLike): void;
|
|
106
|
+
/**
|
|
107
|
+
* Synchronous `mkdir`. Mode defaults to `o777`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function mkdirSync(this: V_Context, path: fs.PathLike, options: fs.MakeDirectoryOptions & {
|
|
110
|
+
recursive: true;
|
|
111
|
+
}): string | undefined;
|
|
112
|
+
export declare function mkdirSync(this: V_Context, path: fs.PathLike, options?: fs.Mode | (fs.MakeDirectoryOptions & {
|
|
113
|
+
recursive?: false;
|
|
114
|
+
}) | null): void;
|
|
115
|
+
export declare function mkdirSync(this: V_Context, path: fs.PathLike, options?: fs.Mode | fs.MakeDirectoryOptions | null): string | undefined;
|
|
116
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options?: {
|
|
117
|
+
encoding: BufferEncoding | null;
|
|
118
|
+
withFileTypes?: false;
|
|
119
|
+
recursive?: boolean;
|
|
120
|
+
} | BufferEncoding | null): string[];
|
|
121
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options: {
|
|
122
|
+
encoding: 'buffer';
|
|
123
|
+
withFileTypes?: false;
|
|
124
|
+
recursive?: boolean;
|
|
125
|
+
} | 'buffer'): Buffer[];
|
|
126
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options?: (fs.ObjectEncodingOptions & {
|
|
127
|
+
withFileTypes?: false;
|
|
128
|
+
recursive?: boolean;
|
|
129
|
+
}) | BufferEncoding | null): string[] | Buffer[];
|
|
130
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options: fs.ObjectEncodingOptions & {
|
|
131
|
+
withFileTypes: true;
|
|
132
|
+
recursive?: boolean;
|
|
133
|
+
}): Dirent[];
|
|
134
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options: {
|
|
135
|
+
encoding: 'buffer';
|
|
136
|
+
withFileTypes: true;
|
|
137
|
+
recursive?: boolean;
|
|
138
|
+
}): Dirent<Buffer>[];
|
|
139
|
+
export declare function readdirSync(this: V_Context, path: fs.PathLike, options?: NodeReaddirOptions): string[] | Dirent<any>[] | Buffer[];
|
|
140
|
+
export declare function linkSync(this: V_Context, targetPath: fs.PathLike, linkPath: fs.PathLike): void;
|
|
141
|
+
/**
|
|
142
|
+
* Synchronous `symlink`.
|
|
143
|
+
* @param target target path
|
|
144
|
+
* @param path link path
|
|
145
|
+
* @param type can be either `'dir'` or `'file'` (default is `'file'`)
|
|
146
|
+
*/
|
|
147
|
+
export declare function symlinkSync(this: V_Context, target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type | null): void;
|
|
148
|
+
export declare function readlinkSync(this: V_Context, path: fs.PathLike, options?: fs.BufferEncodingOption): Buffer;
|
|
149
|
+
export declare function readlinkSync(this: V_Context, path: fs.PathLike, options: fs.EncodingOption | BufferEncoding): string;
|
|
150
|
+
export declare function readlinkSync(this: V_Context, path: fs.PathLike, options?: fs.EncodingOption | BufferEncoding | fs.BufferEncodingOption): Buffer | string;
|
|
151
|
+
export declare function chownSync(this: V_Context, path: fs.PathLike, uid: number, gid: number): void;
|
|
152
|
+
export declare function lchownSync(this: V_Context, path: fs.PathLike, uid: number, gid: number): void;
|
|
153
|
+
export declare function chmodSync(this: V_Context, path: fs.PathLike, mode: fs.Mode): void;
|
|
154
|
+
export declare function lchmodSync(this: V_Context, path: fs.PathLike, mode: number | string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Change file timestamps of the file referenced by the supplied path.
|
|
157
|
+
*/
|
|
158
|
+
export declare function utimesSync(this: V_Context, path: fs.PathLike, atime: fs.TimeLike, mtime: fs.TimeLike): void;
|
|
159
|
+
/**
|
|
160
|
+
* Change file timestamps of the file referenced by the supplied path.
|
|
161
|
+
*/
|
|
162
|
+
export declare function lutimesSync(this: V_Context, path: fs.PathLike, atime: fs.TimeLike, mtime: fs.TimeLike): void;
|
|
163
|
+
export declare function realpathSync(this: V_Context, path: fs.PathLike, options: fs.BufferEncodingOption): Buffer;
|
|
164
|
+
export declare function realpathSync(this: V_Context, path: fs.PathLike, options?: fs.EncodingOption): string;
|
|
165
|
+
export declare function accessSync(this: V_Context, path: fs.PathLike, mode?: number): void;
|
|
166
|
+
/**
|
|
167
|
+
* Synchronous `rm`. Removes files or directories (recursively).
|
|
168
|
+
* @param path The path to the file or directory to remove.
|
|
169
|
+
*/
|
|
170
|
+
export declare function rmSync(this: V_Context, path: fs.PathLike, options?: fs.RmOptions): void;
|
|
171
|
+
/**
|
|
172
|
+
* Synchronous `mkdtemp`. Creates a unique temporary directory.
|
|
173
|
+
* @param prefix The directory prefix.
|
|
174
|
+
* @param options The encoding (or an object including `encoding`).
|
|
175
|
+
* @returns The path to the created temporary directory, encoded as a string or buffer.
|
|
176
|
+
*/
|
|
177
|
+
export declare function mkdtempSync(this: V_Context, prefix: fs.PathLike, options: fs.BufferEncodingOption): Buffer;
|
|
178
|
+
export declare function mkdtempSync(this: V_Context, prefix: fs.PathLike, options?: fs.EncodingOption): string;
|
|
179
|
+
/**
|
|
180
|
+
* Returns a disposable object whose `path` property holds the created directory path.
|
|
181
|
+
* When the object is disposed, the directory and its contents will be removed if it still exists.
|
|
182
|
+
* If the directory cannot be deleted, disposal will throw an error.
|
|
183
|
+
* The object has a `remove()` method which will perform the same task.
|
|
184
|
+
* @todo Add `satisfies` and maybe change return type once @types/node adds this.
|
|
185
|
+
*/
|
|
186
|
+
export declare function mkdtempDisposableSync(this: V_Context, prefix: fs.PathLike, options?: fs.EncodingOption | fs.BufferEncodingOption): {
|
|
187
|
+
path: string;
|
|
188
|
+
remove(): void;
|
|
189
|
+
[Symbol.dispose](): void;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Synchronous `copyFile`. Copies a file.
|
|
193
|
+
* @param flags Optional flags for the copy operation. Currently supports these flags:
|
|
194
|
+
* - `fs.constants.COPYFILE_EXCL`: If the destination file already exists, the operation fails.
|
|
195
|
+
*/
|
|
196
|
+
export declare function copyFileSync(this: V_Context, source: fs.PathLike, destination: fs.PathLike, flags?: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Synchronous `readv`. Reads from a file descriptor into multiple buffers.
|
|
199
|
+
* @param fd The file descriptor.
|
|
200
|
+
* @param buffers An array of Uint8Array buffers.
|
|
201
|
+
* @param position The position in the file where to begin reading.
|
|
202
|
+
* @returns The number of bytes read.
|
|
203
|
+
*/
|
|
204
|
+
export declare function readvSync(this: V_Context, fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
205
|
+
/**
|
|
206
|
+
* Synchronous `writev`. Writes from multiple buffers into a file descriptor.
|
|
207
|
+
* @param fd The file descriptor.
|
|
208
|
+
* @param buffers An array of Uint8Array buffers.
|
|
209
|
+
* @param position The position in the file where to begin writing.
|
|
210
|
+
* @returns The number of bytes written.
|
|
211
|
+
*/
|
|
212
|
+
export declare function writevSync(this: V_Context, fd: number, buffers: readonly ArrayBufferView[], position?: number): number;
|
|
213
|
+
/**
|
|
214
|
+
* Synchronous `opendir`. Opens a directory.
|
|
215
|
+
* @param path The path to the directory.
|
|
216
|
+
* @param options Options for opening the directory.
|
|
217
|
+
* @returns A `Dir` object representing the opened directory.
|
|
218
|
+
* @todo Handle options
|
|
219
|
+
*/
|
|
220
|
+
export declare function opendirSync(this: V_Context, path: fs.PathLike, options?: fs.OpenDirOptions): Dir;
|
|
221
|
+
/**
|
|
222
|
+
* Synchronous `cp`. Recursively copies a file or directory.
|
|
223
|
+
* @param source The source file or directory.
|
|
224
|
+
* @param destination The destination file or directory.
|
|
225
|
+
* @param opts Options for the copy operation. Currently supports these options from Node.js 'fs.cpSync':
|
|
226
|
+
* - `dereference`: Dereference symbolic links. *(unconfirmed)*
|
|
227
|
+
* - `errorOnExist`: Throw an error if the destination file or directory already exists.
|
|
228
|
+
* - `filter`: A function that takes a source and destination path and returns a boolean, indicating whether to copy `source` element.
|
|
229
|
+
* - `force`: Overwrite the destination if it exists, and overwrite existing readonly destination files. *(unconfirmed)*
|
|
230
|
+
* - `preserveTimestamps`: Preserve file timestamps.
|
|
231
|
+
* - `recursive`: If `true`, copies directories recursively.
|
|
232
|
+
*/
|
|
233
|
+
export declare function cpSync(this: V_Context, source: fs.PathLike, destination: fs.PathLike, opts?: fs.CopySyncOptions): void;
|
|
234
|
+
/**
|
|
235
|
+
* Synchronous statfs(2). Returns information about the mounted file system which contains path.
|
|
236
|
+
* In case of an error, the err.code will be one of Common System Errors.
|
|
237
|
+
* @param path A path to an existing file or directory on the file system to be queried.
|
|
238
|
+
*/
|
|
239
|
+
export declare function statfsSync(this: V_Context, path: fs.PathLike, options?: fs.StatFsOptions & {
|
|
240
|
+
bigint?: false;
|
|
241
|
+
}): fs.StatsFs;
|
|
242
|
+
export declare function statfsSync(this: V_Context, path: fs.PathLike, options: fs.StatFsOptions & {
|
|
243
|
+
bigint: true;
|
|
244
|
+
}): fs.BigIntStatsFs;
|
|
245
|
+
export declare function statfsSync(this: V_Context, path: fs.PathLike, options?: fs.StatFsOptions): fs.StatsFs | fs.BigIntStatsFs;
|
|
246
|
+
/**
|
|
247
|
+
* Retrieves the files matching the specified pattern.
|
|
248
|
+
*/
|
|
249
|
+
export declare function globSync(pattern: string | readonly string[]): string[];
|
|
250
|
+
export declare function globSync(pattern: string | readonly string[], options: fs.GlobOptionsWithFileTypes): Dirent[];
|
|
251
|
+
export declare function globSync(pattern: string | readonly string[], options: fs.GlobOptionsWithoutFileTypes): string[];
|
|
252
|
+
export declare function globSync(pattern: string | readonly string[], options: fs.GlobOptions): Dirent[] | string[];
|