@vercel/sandbox 2.0.0-beta.13 → 2.0.0-beta.18
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/api-client/api-client.cjs +3 -15
- package/dist/api-client/api-client.cjs.map +1 -1
- package/dist/api-client/api-client.d.cts +5510 -76
- package/dist/api-client/api-client.d.ts +5510 -76
- package/dist/api-client/api-client.js +4 -16
- package/dist/api-client/api-client.js.map +1 -1
- package/dist/api-client/base-client.cjs +2 -1
- package/dist/api-client/base-client.cjs.map +1 -1
- package/dist/api-client/base-client.js +2 -1
- package/dist/api-client/base-client.js.map +1 -1
- package/dist/api-client/index.d.ts +1 -1
- package/dist/api-client/index.js +1 -1
- package/dist/api-client/validators.cjs +60 -16
- package/dist/api-client/validators.cjs.map +1 -1
- package/dist/api-client/validators.d.cts +25546 -130
- package/dist/api-client/validators.d.ts +25546 -130
- package/dist/api-client/validators.js +55 -16
- package/dist/api-client/validators.js.map +1 -1
- package/dist/auth/api.cjs +1 -1
- package/dist/auth/api.cjs.map +1 -1
- package/dist/auth/api.js +1 -1
- package/dist/auth/api.js.map +1 -1
- package/dist/auth/file.d.cts +3 -3
- package/dist/auth/file.d.ts +3 -3
- package/dist/auth/index.cjs +0 -1
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/auth/project.cjs +124 -26
- package/dist/auth/project.cjs.map +1 -1
- package/dist/auth/project.d.cts +9 -13
- package/dist/auth/project.d.ts +9 -13
- package/dist/auth/project.js +125 -26
- package/dist/auth/project.js.map +1 -1
- package/dist/filesystem.cjs +499 -0
- package/dist/filesystem.cjs.map +1 -0
- package/dist/filesystem.d.cts +258 -0
- package/dist/filesystem.d.ts +258 -0
- package/dist/filesystem.js +497 -0
- package/dist/filesystem.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/network-policy.d.cts +58 -2
- package/dist/network-policy.d.ts +58 -2
- package/dist/sandbox.cjs +138 -22
- package/dist/sandbox.cjs.map +1 -1
- package/dist/sandbox.d.cts +2069 -22
- package/dist/sandbox.d.ts +2069 -22
- package/dist/sandbox.js +138 -22
- package/dist/sandbox.js.map +1 -1
- package/dist/session.cjs +10 -7
- package/dist/session.cjs.map +1 -1
- package/dist/session.d.cts +7 -5
- package/dist/session.d.ts +7 -5
- package/dist/session.js +10 -7
- package/dist/session.js.map +1 -1
- package/dist/snapshot.cjs +63 -10
- package/dist/snapshot.cjs.map +1 -1
- package/dist/snapshot.d.cts +41 -9
- package/dist/snapshot.d.ts +41 -9
- package/dist/snapshot.js +62 -10
- package/dist/snapshot.js.map +1 -1
- package/dist/utils/network-policy.cjs +23 -39
- package/dist/utils/network-policy.cjs.map +1 -1
- package/dist/utils/network-policy.js +23 -39
- package/dist/utils/network-policy.js.map +1 -1
- package/dist/utils/paginator.cjs +41 -0
- package/dist/utils/paginator.cjs.map +1 -0
- package/dist/utils/paginator.d.cts +16 -0
- package/dist/utils/paginator.d.ts +16 -0
- package/dist/utils/paginator.js +40 -0
- package/dist/utils/paginator.js.map +1 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { Dirent, Stats } from "fs";
|
|
2
|
+
|
|
3
|
+
//#region src/filesystem.d.ts
|
|
4
|
+
type WriteFileData = string | Buffer | Uint8Array;
|
|
5
|
+
interface MkdirOptions {
|
|
6
|
+
recursive?: boolean;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
interface RmOptions {
|
|
10
|
+
recursive?: boolean;
|
|
11
|
+
force?: boolean;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
interface SandboxHandle {
|
|
15
|
+
readFileToBuffer(file: {
|
|
16
|
+
path: string;
|
|
17
|
+
}, opts?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<Buffer | null>;
|
|
20
|
+
writeFiles(files: {
|
|
21
|
+
path: string;
|
|
22
|
+
content: Buffer;
|
|
23
|
+
}[], opts?: {
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
mkDir(path: string, opts?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
runCommand(cmd: string, args?: string[], opts?: {
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
exitCode: number;
|
|
33
|
+
stdout(opts?: {
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
stderr(opts?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<string>;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
declare class FileSystem {
|
|
42
|
+
/** @internal */
|
|
43
|
+
private sandbox;
|
|
44
|
+
/** @internal */
|
|
45
|
+
constructor(sandbox: SandboxHandle);
|
|
46
|
+
/**
|
|
47
|
+
* Read the entire contents of a file.
|
|
48
|
+
*
|
|
49
|
+
* @param path - Path to the file
|
|
50
|
+
* @param options - Encoding or options object. If encoding is specified, returns a string; otherwise returns a Buffer.
|
|
51
|
+
*/
|
|
52
|
+
readFile(path: string, options?: {
|
|
53
|
+
encoding?: null;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
} | null): Promise<Buffer>;
|
|
56
|
+
readFile(path: string, options: {
|
|
57
|
+
encoding: BufferEncoding;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
} | BufferEncoding): Promise<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Write data to a file, replacing the file if it already exists.
|
|
62
|
+
*
|
|
63
|
+
* @param path - Path to the file
|
|
64
|
+
* @param data - The data to write
|
|
65
|
+
* @param options - Write options
|
|
66
|
+
*/
|
|
67
|
+
writeFile(path: string, data: WriteFileData, options?: {
|
|
68
|
+
encoding?: BufferEncoding;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
} | BufferEncoding): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Append data to a file, creating the file if it does not yet exist.
|
|
73
|
+
*
|
|
74
|
+
* @param path - Path to the file
|
|
75
|
+
* @param data - The data to append
|
|
76
|
+
* @param options - Write options
|
|
77
|
+
*/
|
|
78
|
+
appendFile(path: string, data: WriteFileData, options?: {
|
|
79
|
+
encoding?: BufferEncoding;
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
} | BufferEncoding): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Create a directory.
|
|
84
|
+
*
|
|
85
|
+
* @param path - Path of the directory to create
|
|
86
|
+
* @param options - Options for directory creation
|
|
87
|
+
*/
|
|
88
|
+
mkdir(path: string, options?: MkdirOptions | number): Promise<string | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Read the contents of a directory.
|
|
91
|
+
*
|
|
92
|
+
* @param path - Path to the directory
|
|
93
|
+
* @param options - Options. When `withFileTypes` is true, returns `Dirent` objects.
|
|
94
|
+
*/
|
|
95
|
+
readdir(path: string, options?: {
|
|
96
|
+
signal?: AbortSignal;
|
|
97
|
+
withFileTypes?: false;
|
|
98
|
+
}): Promise<string[]>;
|
|
99
|
+
readdir(path: string, options: {
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
withFileTypes: true;
|
|
102
|
+
}): Promise<Dirent[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Get file status. Follows symbolic links.
|
|
105
|
+
*
|
|
106
|
+
* @param path - Path to the file
|
|
107
|
+
* @param options - Options
|
|
108
|
+
*/
|
|
109
|
+
stat(path: string, options?: {
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
}): Promise<Stats>;
|
|
112
|
+
/**
|
|
113
|
+
* Get file status. Does not follow symbolic links.
|
|
114
|
+
*
|
|
115
|
+
* @param path - Path to the file
|
|
116
|
+
* @param options - Options
|
|
117
|
+
*/
|
|
118
|
+
lstat(path: string, options?: {
|
|
119
|
+
signal?: AbortSignal;
|
|
120
|
+
}): Promise<Stats>;
|
|
121
|
+
/**
|
|
122
|
+
* Remove a file or symbolic link.
|
|
123
|
+
*
|
|
124
|
+
* @param path - Path to the file
|
|
125
|
+
* @param options - Options
|
|
126
|
+
*/
|
|
127
|
+
unlink(path: string, options?: {
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Remove files and directories.
|
|
132
|
+
*
|
|
133
|
+
* @param path - Path to remove
|
|
134
|
+
* @param options - Options
|
|
135
|
+
*/
|
|
136
|
+
rm(path: string, options?: RmOptions): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Remove a directory.
|
|
139
|
+
*
|
|
140
|
+
* @param path - Path to the directory
|
|
141
|
+
* @param options - Options
|
|
142
|
+
*/
|
|
143
|
+
rmdir(path: string, options?: {
|
|
144
|
+
signal?: AbortSignal;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Rename a file or directory.
|
|
148
|
+
*
|
|
149
|
+
* @param oldPath - Current path
|
|
150
|
+
* @param newPath - New path
|
|
151
|
+
* @param options - Options
|
|
152
|
+
*/
|
|
153
|
+
rename(oldPath: string, newPath: string, options?: {
|
|
154
|
+
signal?: AbortSignal;
|
|
155
|
+
}): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Copy a file.
|
|
158
|
+
*
|
|
159
|
+
* @param src - Source path
|
|
160
|
+
* @param dest - Destination path
|
|
161
|
+
* @param options - Options
|
|
162
|
+
*/
|
|
163
|
+
copyFile(src: string, dest: string, options?: {
|
|
164
|
+
signal?: AbortSignal;
|
|
165
|
+
}): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Test whether a file exists and the user has the specified permissions.
|
|
168
|
+
*
|
|
169
|
+
* @param path - Path to the file
|
|
170
|
+
* @param options - Options
|
|
171
|
+
*/
|
|
172
|
+
access(path: string, options?: {
|
|
173
|
+
signal?: AbortSignal;
|
|
174
|
+
}): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Check if a path exists.
|
|
177
|
+
*
|
|
178
|
+
* This is a convenience method not in `node:fs/promises` but commonly needed.
|
|
179
|
+
*
|
|
180
|
+
* @param path - Path to check
|
|
181
|
+
* @param options - Options
|
|
182
|
+
*/
|
|
183
|
+
exists(path: string, options?: {
|
|
184
|
+
signal?: AbortSignal;
|
|
185
|
+
}): Promise<boolean>;
|
|
186
|
+
/**
|
|
187
|
+
* Change file mode (permissions).
|
|
188
|
+
*
|
|
189
|
+
* @param path - Path to the file
|
|
190
|
+
* @param mode - File mode (e.g., 0o755 or "755")
|
|
191
|
+
* @param options - Options
|
|
192
|
+
*/
|
|
193
|
+
chmod(path: string, mode: number | string, options?: {
|
|
194
|
+
signal?: AbortSignal;
|
|
195
|
+
}): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Change file owner and group.
|
|
198
|
+
*
|
|
199
|
+
* @param path - Path to the file
|
|
200
|
+
* @param uid - User ID
|
|
201
|
+
* @param gid - Group ID
|
|
202
|
+
* @param options - Options
|
|
203
|
+
*/
|
|
204
|
+
chown(path: string, uid: number, gid: number, options?: {
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
}): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Create a symbolic link.
|
|
209
|
+
*
|
|
210
|
+
* @param target - The target of the symbolic link
|
|
211
|
+
* @param path - The path of the symbolic link to create
|
|
212
|
+
* @param options - Options
|
|
213
|
+
*/
|
|
214
|
+
symlink(target: string, path: string, options?: {
|
|
215
|
+
signal?: AbortSignal;
|
|
216
|
+
}): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Read the value of a symbolic link.
|
|
219
|
+
*
|
|
220
|
+
* @param path - Path to the symbolic link
|
|
221
|
+
* @param options - Options
|
|
222
|
+
*/
|
|
223
|
+
readlink(path: string, options?: {
|
|
224
|
+
signal?: AbortSignal;
|
|
225
|
+
}): Promise<string>;
|
|
226
|
+
/**
|
|
227
|
+
* Resolve the real path of a file (resolving symlinks).
|
|
228
|
+
*
|
|
229
|
+
* @param path - Path to resolve
|
|
230
|
+
* @param options - Options
|
|
231
|
+
*/
|
|
232
|
+
realpath(path: string, options?: {
|
|
233
|
+
signal?: AbortSignal;
|
|
234
|
+
}): Promise<string>;
|
|
235
|
+
/**
|
|
236
|
+
* Truncate a file to a specified length.
|
|
237
|
+
*
|
|
238
|
+
* @param path - Path to the file
|
|
239
|
+
* @param len - Length to truncate to (default: 0)
|
|
240
|
+
* @param options - Options
|
|
241
|
+
*/
|
|
242
|
+
truncate(path: string, len?: number, options?: {
|
|
243
|
+
signal?: AbortSignal;
|
|
244
|
+
}): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Create a unique temporary directory.
|
|
247
|
+
*
|
|
248
|
+
* @param prefix - The prefix for the temporary directory name
|
|
249
|
+
* @param options - Options
|
|
250
|
+
* @returns The path of the created temporary directory
|
|
251
|
+
*/
|
|
252
|
+
mkdtemp(prefix: string, options?: {
|
|
253
|
+
signal?: AbortSignal;
|
|
254
|
+
}): Promise<string>;
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
export { FileSystem };
|
|
258
|
+
//# sourceMappingURL=filesystem.d.cts.map
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { Dirent, Stats } from "fs";
|
|
2
|
+
|
|
3
|
+
//#region src/filesystem.d.ts
|
|
4
|
+
type WriteFileData = string | Buffer | Uint8Array;
|
|
5
|
+
interface MkdirOptions {
|
|
6
|
+
recursive?: boolean;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
interface RmOptions {
|
|
10
|
+
recursive?: boolean;
|
|
11
|
+
force?: boolean;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
interface SandboxHandle {
|
|
15
|
+
readFileToBuffer(file: {
|
|
16
|
+
path: string;
|
|
17
|
+
}, opts?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<Buffer | null>;
|
|
20
|
+
writeFiles(files: {
|
|
21
|
+
path: string;
|
|
22
|
+
content: Buffer;
|
|
23
|
+
}[], opts?: {
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
mkDir(path: string, opts?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
runCommand(cmd: string, args?: string[], opts?: {
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
exitCode: number;
|
|
33
|
+
stdout(opts?: {
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
stderr(opts?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<string>;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
declare class FileSystem {
|
|
42
|
+
/** @internal */
|
|
43
|
+
private sandbox;
|
|
44
|
+
/** @internal */
|
|
45
|
+
constructor(sandbox: SandboxHandle);
|
|
46
|
+
/**
|
|
47
|
+
* Read the entire contents of a file.
|
|
48
|
+
*
|
|
49
|
+
* @param path - Path to the file
|
|
50
|
+
* @param options - Encoding or options object. If encoding is specified, returns a string; otherwise returns a Buffer.
|
|
51
|
+
*/
|
|
52
|
+
readFile(path: string, options?: {
|
|
53
|
+
encoding?: null;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
} | null): Promise<Buffer>;
|
|
56
|
+
readFile(path: string, options: {
|
|
57
|
+
encoding: BufferEncoding;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
} | BufferEncoding): Promise<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Write data to a file, replacing the file if it already exists.
|
|
62
|
+
*
|
|
63
|
+
* @param path - Path to the file
|
|
64
|
+
* @param data - The data to write
|
|
65
|
+
* @param options - Write options
|
|
66
|
+
*/
|
|
67
|
+
writeFile(path: string, data: WriteFileData, options?: {
|
|
68
|
+
encoding?: BufferEncoding;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
} | BufferEncoding): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Append data to a file, creating the file if it does not yet exist.
|
|
73
|
+
*
|
|
74
|
+
* @param path - Path to the file
|
|
75
|
+
* @param data - The data to append
|
|
76
|
+
* @param options - Write options
|
|
77
|
+
*/
|
|
78
|
+
appendFile(path: string, data: WriteFileData, options?: {
|
|
79
|
+
encoding?: BufferEncoding;
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
} | BufferEncoding): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Create a directory.
|
|
84
|
+
*
|
|
85
|
+
* @param path - Path of the directory to create
|
|
86
|
+
* @param options - Options for directory creation
|
|
87
|
+
*/
|
|
88
|
+
mkdir(path: string, options?: MkdirOptions | number): Promise<string | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Read the contents of a directory.
|
|
91
|
+
*
|
|
92
|
+
* @param path - Path to the directory
|
|
93
|
+
* @param options - Options. When `withFileTypes` is true, returns `Dirent` objects.
|
|
94
|
+
*/
|
|
95
|
+
readdir(path: string, options?: {
|
|
96
|
+
signal?: AbortSignal;
|
|
97
|
+
withFileTypes?: false;
|
|
98
|
+
}): Promise<string[]>;
|
|
99
|
+
readdir(path: string, options: {
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
withFileTypes: true;
|
|
102
|
+
}): Promise<Dirent[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Get file status. Follows symbolic links.
|
|
105
|
+
*
|
|
106
|
+
* @param path - Path to the file
|
|
107
|
+
* @param options - Options
|
|
108
|
+
*/
|
|
109
|
+
stat(path: string, options?: {
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
}): Promise<Stats>;
|
|
112
|
+
/**
|
|
113
|
+
* Get file status. Does not follow symbolic links.
|
|
114
|
+
*
|
|
115
|
+
* @param path - Path to the file
|
|
116
|
+
* @param options - Options
|
|
117
|
+
*/
|
|
118
|
+
lstat(path: string, options?: {
|
|
119
|
+
signal?: AbortSignal;
|
|
120
|
+
}): Promise<Stats>;
|
|
121
|
+
/**
|
|
122
|
+
* Remove a file or symbolic link.
|
|
123
|
+
*
|
|
124
|
+
* @param path - Path to the file
|
|
125
|
+
* @param options - Options
|
|
126
|
+
*/
|
|
127
|
+
unlink(path: string, options?: {
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Remove files and directories.
|
|
132
|
+
*
|
|
133
|
+
* @param path - Path to remove
|
|
134
|
+
* @param options - Options
|
|
135
|
+
*/
|
|
136
|
+
rm(path: string, options?: RmOptions): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Remove a directory.
|
|
139
|
+
*
|
|
140
|
+
* @param path - Path to the directory
|
|
141
|
+
* @param options - Options
|
|
142
|
+
*/
|
|
143
|
+
rmdir(path: string, options?: {
|
|
144
|
+
signal?: AbortSignal;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Rename a file or directory.
|
|
148
|
+
*
|
|
149
|
+
* @param oldPath - Current path
|
|
150
|
+
* @param newPath - New path
|
|
151
|
+
* @param options - Options
|
|
152
|
+
*/
|
|
153
|
+
rename(oldPath: string, newPath: string, options?: {
|
|
154
|
+
signal?: AbortSignal;
|
|
155
|
+
}): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Copy a file.
|
|
158
|
+
*
|
|
159
|
+
* @param src - Source path
|
|
160
|
+
* @param dest - Destination path
|
|
161
|
+
* @param options - Options
|
|
162
|
+
*/
|
|
163
|
+
copyFile(src: string, dest: string, options?: {
|
|
164
|
+
signal?: AbortSignal;
|
|
165
|
+
}): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Test whether a file exists and the user has the specified permissions.
|
|
168
|
+
*
|
|
169
|
+
* @param path - Path to the file
|
|
170
|
+
* @param options - Options
|
|
171
|
+
*/
|
|
172
|
+
access(path: string, options?: {
|
|
173
|
+
signal?: AbortSignal;
|
|
174
|
+
}): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Check if a path exists.
|
|
177
|
+
*
|
|
178
|
+
* This is a convenience method not in `node:fs/promises` but commonly needed.
|
|
179
|
+
*
|
|
180
|
+
* @param path - Path to check
|
|
181
|
+
* @param options - Options
|
|
182
|
+
*/
|
|
183
|
+
exists(path: string, options?: {
|
|
184
|
+
signal?: AbortSignal;
|
|
185
|
+
}): Promise<boolean>;
|
|
186
|
+
/**
|
|
187
|
+
* Change file mode (permissions).
|
|
188
|
+
*
|
|
189
|
+
* @param path - Path to the file
|
|
190
|
+
* @param mode - File mode (e.g., 0o755 or "755")
|
|
191
|
+
* @param options - Options
|
|
192
|
+
*/
|
|
193
|
+
chmod(path: string, mode: number | string, options?: {
|
|
194
|
+
signal?: AbortSignal;
|
|
195
|
+
}): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Change file owner and group.
|
|
198
|
+
*
|
|
199
|
+
* @param path - Path to the file
|
|
200
|
+
* @param uid - User ID
|
|
201
|
+
* @param gid - Group ID
|
|
202
|
+
* @param options - Options
|
|
203
|
+
*/
|
|
204
|
+
chown(path: string, uid: number, gid: number, options?: {
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
}): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Create a symbolic link.
|
|
209
|
+
*
|
|
210
|
+
* @param target - The target of the symbolic link
|
|
211
|
+
* @param path - The path of the symbolic link to create
|
|
212
|
+
* @param options - Options
|
|
213
|
+
*/
|
|
214
|
+
symlink(target: string, path: string, options?: {
|
|
215
|
+
signal?: AbortSignal;
|
|
216
|
+
}): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Read the value of a symbolic link.
|
|
219
|
+
*
|
|
220
|
+
* @param path - Path to the symbolic link
|
|
221
|
+
* @param options - Options
|
|
222
|
+
*/
|
|
223
|
+
readlink(path: string, options?: {
|
|
224
|
+
signal?: AbortSignal;
|
|
225
|
+
}): Promise<string>;
|
|
226
|
+
/**
|
|
227
|
+
* Resolve the real path of a file (resolving symlinks).
|
|
228
|
+
*
|
|
229
|
+
* @param path - Path to resolve
|
|
230
|
+
* @param options - Options
|
|
231
|
+
*/
|
|
232
|
+
realpath(path: string, options?: {
|
|
233
|
+
signal?: AbortSignal;
|
|
234
|
+
}): Promise<string>;
|
|
235
|
+
/**
|
|
236
|
+
* Truncate a file to a specified length.
|
|
237
|
+
*
|
|
238
|
+
* @param path - Path to the file
|
|
239
|
+
* @param len - Length to truncate to (default: 0)
|
|
240
|
+
* @param options - Options
|
|
241
|
+
*/
|
|
242
|
+
truncate(path: string, len?: number, options?: {
|
|
243
|
+
signal?: AbortSignal;
|
|
244
|
+
}): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Create a unique temporary directory.
|
|
247
|
+
*
|
|
248
|
+
* @param prefix - The prefix for the temporary directory name
|
|
249
|
+
* @param options - Options
|
|
250
|
+
* @returns The path of the created temporary directory
|
|
251
|
+
*/
|
|
252
|
+
mkdtemp(prefix: string, options?: {
|
|
253
|
+
signal?: AbortSignal;
|
|
254
|
+
}): Promise<string>;
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
export { FileSystem };
|
|
258
|
+
//# sourceMappingURL=filesystem.d.ts.map
|