@zenfs/core 0.9.6 → 0.10.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/AsyncStore.d.ts +3 -2
- package/dist/backends/AsyncStore.js +40 -33
- package/dist/backends/Fetch.d.ts +84 -0
- package/dist/backends/Fetch.js +171 -0
- package/dist/backends/InMemory.d.ts +1 -1
- package/dist/backends/Index.d.ts +7 -10
- package/dist/backends/Index.js +26 -24
- package/dist/backends/Locked.d.ts +11 -11
- package/dist/backends/Locked.js +50 -49
- package/dist/backends/Overlay.js +22 -22
- package/dist/backends/SyncStore.d.ts +6 -6
- package/dist/backends/SyncStore.js +30 -30
- package/dist/backends/backend.d.ts +5 -4
- package/dist/backends/backend.js +6 -6
- package/dist/backends/port/fs.d.ts +124 -0
- package/dist/backends/port/fs.js +241 -0
- package/dist/backends/port/rpc.d.ts +60 -0
- package/dist/backends/port/rpc.js +71 -0
- package/dist/backends/port/store.d.ts +30 -0
- package/dist/backends/port/store.js +142 -0
- package/dist/browser.min.js +4 -4
- package/dist/browser.min.js.map +4 -4
- package/dist/config.d.ts +9 -11
- package/dist/config.js +13 -13
- package/dist/emulation/async.d.ts +76 -77
- package/dist/emulation/async.js +45 -45
- package/dist/emulation/dir.js +8 -7
- package/dist/emulation/index.d.ts +1 -1
- package/dist/emulation/index.js +1 -1
- package/dist/emulation/path.d.ts +3 -2
- package/dist/emulation/path.js +19 -45
- package/dist/emulation/promises.d.ts +112 -113
- package/dist/emulation/promises.js +167 -173
- package/dist/emulation/shared.d.ts +6 -17
- package/dist/emulation/shared.js +9 -9
- package/dist/emulation/streams.js +3 -2
- package/dist/emulation/sync.d.ts +71 -64
- package/dist/emulation/sync.js +62 -63
- package/dist/{ApiError.d.ts → error.d.ts} +15 -15
- package/dist/error.js +292 -0
- package/dist/file.d.ts +6 -4
- package/dist/file.js +17 -9
- package/dist/filesystem.d.ts +1 -1
- package/dist/filesystem.js +18 -15
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/mutex.js +4 -3
- package/dist/stats.d.ts +7 -7
- package/dist/stats.js +50 -10
- package/dist/utils.d.ts +10 -9
- package/dist/utils.js +15 -15
- package/package.json +5 -5
- package/readme.md +19 -11
- package/src/backends/AsyncStore.ts +42 -36
- package/src/backends/Fetch.ts +230 -0
- package/src/backends/Index.ts +33 -29
- package/src/backends/Locked.ts +50 -49
- package/src/backends/Overlay.ts +24 -24
- package/src/backends/SyncStore.ts +34 -34
- package/src/backends/backend.ts +13 -11
- package/src/backends/port/fs.ts +308 -0
- package/src/backends/port/readme.md +59 -0
- package/src/backends/port/rpc.ts +144 -0
- package/src/backends/port/store.ts +187 -0
- package/src/config.ts +25 -29
- package/src/emulation/async.ts +191 -199
- package/src/emulation/dir.ts +8 -8
- package/src/emulation/index.ts +1 -1
- package/src/emulation/path.ts +25 -49
- package/src/emulation/promises.ts +286 -287
- package/src/emulation/shared.ts +14 -23
- package/src/emulation/streams.ts +9 -8
- package/src/emulation/sync.ts +182 -182
- package/src/{ApiError.ts → error.ts} +91 -89
- package/src/file.ts +23 -13
- package/src/filesystem.ts +26 -22
- package/src/index.ts +4 -1
- package/src/mutex.ts +6 -4
- package/src/stats.ts +32 -23
- package/src/utils.ts +23 -24
- package/tsconfig.json +4 -3
- package/dist/ApiError.js +0 -292
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Cred } from '../cred.js';
|
|
2
2
|
import type { File } from '../file.js';
|
|
3
3
|
import { FileSystem } from '../filesystem.js';
|
|
4
|
+
import { type AbsolutePath } from './path.js';
|
|
4
5
|
export declare let cred: Cred;
|
|
5
6
|
export declare function setCred(val: Cred): void;
|
|
6
7
|
export declare const fdMap: Map<number, File>;
|
|
7
|
-
export declare function
|
|
8
|
+
export declare function file2fd(file: File): number;
|
|
8
9
|
export declare function fd2file(fd: number): File;
|
|
9
|
-
export
|
|
10
|
-
[point: string]: FileSystem;
|
|
11
|
-
}
|
|
10
|
+
export type MountObject = Record<AbsolutePath, FileSystem>;
|
|
12
11
|
/**
|
|
13
12
|
* The map of mount points
|
|
14
13
|
* @internal
|
|
@@ -33,16 +32,6 @@ export declare function resolveMount(path: string): {
|
|
|
33
32
|
/**
|
|
34
33
|
* Reverse maps the paths in text from the mounted FileSystem to the global path
|
|
35
34
|
*/
|
|
36
|
-
export declare function fixPaths(text: string, paths:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export declare function fixError<E extends Error>(e: E, paths: {
|
|
40
|
-
[from: string]: string;
|
|
41
|
-
}): E;
|
|
42
|
-
export declare function mountMapping(mountMapping: MountMapping): void;
|
|
43
|
-
/**
|
|
44
|
-
* Types supports as path parameters.
|
|
45
|
-
*
|
|
46
|
-
* In the future, maybe support URL?
|
|
47
|
-
*/
|
|
48
|
-
export type PathLike = string;
|
|
35
|
+
export declare function fixPaths(text: string, paths: Record<string, string>): string;
|
|
36
|
+
export declare function fixError<E extends Error>(e: E, paths: Record<string, string>): E;
|
|
37
|
+
export declare function mountObject(mounts: MountObject): void;
|
package/dist/emulation/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Utilities and shared data
|
|
2
|
-
import {
|
|
2
|
+
import { ErrnoError, Errno } from '../error.js';
|
|
3
3
|
import { InMemory } from '../backends/InMemory.js';
|
|
4
4
|
import { rootCred } from '../cred.js';
|
|
5
5
|
import { normalizePath } from '../utils.js';
|
|
@@ -12,14 +12,14 @@ export function setCred(val) {
|
|
|
12
12
|
// descriptors
|
|
13
13
|
export const fdMap = new Map();
|
|
14
14
|
let nextFd = 100;
|
|
15
|
-
export function
|
|
15
|
+
export function file2fd(file) {
|
|
16
16
|
const fd = nextFd++;
|
|
17
17
|
fdMap.set(fd, file);
|
|
18
18
|
return fd;
|
|
19
19
|
}
|
|
20
20
|
export function fd2file(fd) {
|
|
21
21
|
if (!fdMap.has(fd)) {
|
|
22
|
-
throw new
|
|
22
|
+
throw new ErrnoError(Errno.EBADF);
|
|
23
23
|
}
|
|
24
24
|
return fdMap.get(fd);
|
|
25
25
|
}
|
|
@@ -41,7 +41,7 @@ export function mount(mountPoint, fs) {
|
|
|
41
41
|
}
|
|
42
42
|
mountPoint = resolve(mountPoint);
|
|
43
43
|
if (mounts.has(mountPoint)) {
|
|
44
|
-
throw new
|
|
44
|
+
throw new ErrnoError(Errno.EINVAL, 'Mount point ' + mountPoint + ' is already in use.');
|
|
45
45
|
}
|
|
46
46
|
mounts.set(mountPoint, fs);
|
|
47
47
|
}
|
|
@@ -54,7 +54,7 @@ export function umount(mountPoint) {
|
|
|
54
54
|
}
|
|
55
55
|
mountPoint = resolve(mountPoint);
|
|
56
56
|
if (!mounts.has(mountPoint)) {
|
|
57
|
-
throw new
|
|
57
|
+
throw new ErrnoError(Errno.EINVAL, 'Mount point ' + mountPoint + ' is already unmounted.');
|
|
58
58
|
}
|
|
59
59
|
mounts.delete(mountPoint);
|
|
60
60
|
}
|
|
@@ -74,7 +74,7 @@ export function resolveMount(path) {
|
|
|
74
74
|
return { fs, path, mountPoint };
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
throw new
|
|
77
|
+
throw new ErrnoError(Errno.EIO, 'ZenFS not initialized with a file system');
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Reverse maps the paths in text from the mounted FileSystem to the global path
|
|
@@ -92,11 +92,11 @@ export function fixError(e, paths) {
|
|
|
92
92
|
e.message = fixPaths(e.message, paths);
|
|
93
93
|
return e;
|
|
94
94
|
}
|
|
95
|
-
export function
|
|
96
|
-
if ('/' in
|
|
95
|
+
export function mountObject(mounts) {
|
|
96
|
+
if ('/' in mounts) {
|
|
97
97
|
umount('/');
|
|
98
98
|
}
|
|
99
|
-
for (const [point, fs] of Object.entries(
|
|
99
|
+
for (const [point, fs] of Object.entries(mounts)) {
|
|
100
100
|
mount(point, fs);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Readable, Writable } from 'readable-stream';
|
|
2
|
+
import { ErrnoError, Errno } from '../error.js';
|
|
2
3
|
export class ReadStream extends Readable {
|
|
3
4
|
close(callback = () => null) {
|
|
4
5
|
try {
|
|
@@ -7,7 +8,7 @@ export class ReadStream extends Readable {
|
|
|
7
8
|
callback();
|
|
8
9
|
}
|
|
9
10
|
catch (err) {
|
|
10
|
-
callback(err);
|
|
11
|
+
callback(new ErrnoError(Errno.EIO, err.toString()));
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -19,7 +20,7 @@ export class WriteStream extends Writable {
|
|
|
19
20
|
callback();
|
|
20
21
|
}
|
|
21
22
|
catch (err) {
|
|
22
|
-
callback(err);
|
|
23
|
+
callback(new ErrnoError(Errno.EIO, err.toString()));
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
package/dist/emulation/sync.d.ts
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
4
|
import { Buffer } from 'buffer';
|
|
4
|
-
import type * as
|
|
5
|
-
import type { BufferEncodingOption, EncodingOption, ReadSyncOptions, symlink } from 'fs';
|
|
5
|
+
import type * as fs from 'node:fs';
|
|
6
6
|
import { FileContents } from '../filesystem.js';
|
|
7
7
|
import { BigIntStats, type BigIntStatsFs, type Stats, type StatsFs } from '../stats.js';
|
|
8
8
|
import { Dir, Dirent } from './dir.js';
|
|
9
|
-
import { PathLike } from './shared.js';
|
|
10
9
|
/**
|
|
11
10
|
* Synchronous rename.
|
|
12
11
|
* @param oldPath
|
|
13
12
|
* @param newPath
|
|
14
13
|
*/
|
|
15
|
-
export declare function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
14
|
+
export declare function renameSync(oldPath: fs.PathLike, newPath: fs.PathLike): void;
|
|
16
15
|
/**
|
|
17
16
|
* Test whether or not the given path exists by checking with the file system.
|
|
18
17
|
* @param path
|
|
19
18
|
*/
|
|
20
|
-
export declare function existsSync(path: PathLike): boolean;
|
|
19
|
+
export declare function existsSync(path: fs.PathLike): boolean;
|
|
21
20
|
/**
|
|
22
21
|
* Synchronous `stat`.
|
|
23
22
|
* @param path
|
|
24
23
|
* @returns Stats
|
|
25
24
|
*/
|
|
26
|
-
export declare function statSync(path: PathLike, options?: {
|
|
27
|
-
bigint?:
|
|
25
|
+
export declare function statSync(path: fs.PathLike, options?: {
|
|
26
|
+
bigint?: boolean;
|
|
28
27
|
}): Stats;
|
|
29
|
-
export declare function statSync(path: PathLike, options: {
|
|
28
|
+
export declare function statSync(path: fs.PathLike, options: {
|
|
30
29
|
bigint: true;
|
|
31
30
|
}): BigIntStats;
|
|
32
31
|
/**
|
|
@@ -35,10 +34,10 @@ export declare function statSync(path: PathLike, options: {
|
|
|
35
34
|
* then the link itself is stat-ed, not the file that it refers to.
|
|
36
35
|
* @param path
|
|
37
36
|
*/
|
|
38
|
-
export declare function lstatSync(path: PathLike, options?: {
|
|
39
|
-
bigint?:
|
|
37
|
+
export declare function lstatSync(path: fs.PathLike, options?: {
|
|
38
|
+
bigint?: boolean;
|
|
40
39
|
}): Stats;
|
|
41
|
-
export declare function lstatSync(path: PathLike, options: {
|
|
40
|
+
export declare function lstatSync(path: fs.PathLike, options: {
|
|
42
41
|
bigint: true;
|
|
43
42
|
}): BigIntStats;
|
|
44
43
|
/**
|
|
@@ -46,12 +45,12 @@ export declare function lstatSync(path: PathLike, options: {
|
|
|
46
45
|
* @param path
|
|
47
46
|
* @param len
|
|
48
47
|
*/
|
|
49
|
-
export declare function truncateSync(path: PathLike, len?: number): void;
|
|
48
|
+
export declare function truncateSync(path: fs.PathLike, len?: number | null): void;
|
|
50
49
|
/**
|
|
51
50
|
* Synchronous `unlink`.
|
|
52
51
|
* @param path
|
|
53
52
|
*/
|
|
54
|
-
export declare function unlinkSync(path: PathLike): void;
|
|
53
|
+
export declare function unlinkSync(path: fs.PathLike): void;
|
|
55
54
|
/**
|
|
56
55
|
* Synchronous file open.
|
|
57
56
|
* @see http://www.manpagez.com/man/2/open/
|
|
@@ -60,40 +59,40 @@ export declare function unlinkSync(path: PathLike): void;
|
|
|
60
59
|
* @param mode Mode to use to open the file. Can be ignored if the
|
|
61
60
|
* filesystem doesn't support permissions.
|
|
62
61
|
*/
|
|
63
|
-
export declare function openSync(path: PathLike, flag:
|
|
62
|
+
export declare function openSync(path: fs.PathLike, flag: fs.OpenMode, mode?: fs.Mode | null): number;
|
|
64
63
|
/**
|
|
65
64
|
* Opens a file or symlink
|
|
66
65
|
* @internal
|
|
67
66
|
*/
|
|
68
|
-
export declare function lopenSync(path: PathLike, flag: string, mode?:
|
|
67
|
+
export declare function lopenSync(path: fs.PathLike, flag: string, mode?: fs.Mode | null): number;
|
|
69
68
|
/**
|
|
70
69
|
* Synchronously reads the entire contents of a file.
|
|
71
|
-
* @param
|
|
70
|
+
* @param path
|
|
72
71
|
* @param options
|
|
73
72
|
* @option options encoding The string encoding for the file contents. Defaults to `null`.
|
|
74
73
|
* @option options flag Defaults to `'r'`.
|
|
75
74
|
* @returns file contents
|
|
76
75
|
*/
|
|
77
|
-
export declare function readFileSync(
|
|
76
|
+
export declare function readFileSync(path: fs.PathOrFileDescriptor, options?: {
|
|
78
77
|
flag?: string;
|
|
79
|
-
}): Buffer;
|
|
80
|
-
export declare function readFileSync(
|
|
78
|
+
} | null): Buffer;
|
|
79
|
+
export declare function readFileSync(path: fs.PathOrFileDescriptor, options?: (fs.EncodingOption & {
|
|
81
80
|
flag?: string;
|
|
82
|
-
}) | BufferEncoding): string;
|
|
81
|
+
}) | BufferEncoding | null): string;
|
|
83
82
|
/**
|
|
84
83
|
* Synchronously writes data to a file, replacing the file if it already
|
|
85
84
|
* exists.
|
|
86
85
|
*
|
|
87
86
|
* The encoding option is ignored if data is a buffer.
|
|
88
|
-
* @param
|
|
87
|
+
* @param path
|
|
89
88
|
* @param data
|
|
90
89
|
* @param options
|
|
91
90
|
* @option options encoding Defaults to `'utf8'`.
|
|
92
91
|
* @option options mode Defaults to `0644`.
|
|
93
92
|
* @option options flag Defaults to `'w'`.
|
|
94
93
|
*/
|
|
95
|
-
export declare function writeFileSync(
|
|
96
|
-
export declare function writeFileSync(
|
|
94
|
+
export declare function writeFileSync(path: fs.PathOrFileDescriptor, data: FileContents, options?: fs.WriteFileOptions): void;
|
|
95
|
+
export declare function writeFileSync(path: fs.PathOrFileDescriptor, data: FileContents, encoding?: BufferEncoding): void;
|
|
97
96
|
/**
|
|
98
97
|
* Asynchronously append data to a file, creating the file if it not yet
|
|
99
98
|
* exists.
|
|
@@ -105,7 +104,7 @@ export declare function writeFileSync(filename: string, data: FileContents, enco
|
|
|
105
104
|
* @option options mode Defaults to `0644`.
|
|
106
105
|
* @option options flag Defaults to `'a'`.
|
|
107
106
|
*/
|
|
108
|
-
export declare function appendFileSync(filename:
|
|
107
|
+
export declare function appendFileSync(filename: fs.PathOrFileDescriptor, data: FileContents, _options?: fs.WriteFileOptions): void;
|
|
109
108
|
/**
|
|
110
109
|
* Synchronous `fstat`.
|
|
111
110
|
* `fstat()` is identical to `stat()`, except that the file to be stat-ed is
|
|
@@ -113,7 +112,7 @@ export declare function appendFileSync(filename: string, data: FileContents, _op
|
|
|
113
112
|
* @param fd
|
|
114
113
|
*/
|
|
115
114
|
export declare function fstatSync(fd: number, options?: {
|
|
116
|
-
bigint?:
|
|
115
|
+
bigint?: boolean;
|
|
117
116
|
}): Stats;
|
|
118
117
|
export declare function fstatSync(fd: number, options: {
|
|
119
118
|
bigint: true;
|
|
@@ -128,7 +127,7 @@ export declare function closeSync(fd: number): void;
|
|
|
128
127
|
* @param fd
|
|
129
128
|
* @param len
|
|
130
129
|
*/
|
|
131
|
-
export declare function ftruncateSync(fd: number, len?: number): void;
|
|
130
|
+
export declare function ftruncateSync(fd: number, len?: number | null): void;
|
|
132
131
|
/**
|
|
133
132
|
* Synchronous fsync.
|
|
134
133
|
* @param fd
|
|
@@ -152,8 +151,8 @@ export declare function fdatasyncSync(fd: number): void;
|
|
|
152
151
|
* data should be written. If position is null, the data will be written at
|
|
153
152
|
* the current position.
|
|
154
153
|
*/
|
|
155
|
-
export declare function writeSync(fd: number, data:
|
|
156
|
-
export declare function writeSync(fd: number, data: string, position?: number, encoding?: BufferEncoding): number;
|
|
154
|
+
export declare function writeSync(fd: number, data: ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
|
|
155
|
+
export declare function writeSync(fd: number, data: string, position?: number | null, encoding?: BufferEncoding | null): number;
|
|
157
156
|
/**
|
|
158
157
|
* Read data from the file specified by `fd`.
|
|
159
158
|
* @param fd
|
|
@@ -166,8 +165,8 @@ export declare function writeSync(fd: number, data: string, position?: number, e
|
|
|
166
165
|
* in the file. If position is null, data will be read from the current file
|
|
167
166
|
* position.
|
|
168
167
|
*/
|
|
169
|
-
export declare function readSync(fd: number, buffer:
|
|
170
|
-
export declare function readSync(fd: number, buffer:
|
|
168
|
+
export declare function readSync(fd: number, buffer: ArrayBufferView, opts?: fs.ReadSyncOptions): number;
|
|
169
|
+
export declare function readSync(fd: number, buffer: ArrayBufferView, offset: number, length: number, position?: fs.ReadPosition | null): number;
|
|
171
170
|
/**
|
|
172
171
|
* Synchronous `fchown`.
|
|
173
172
|
* @param fd
|
|
@@ -193,93 +192,101 @@ export declare function futimesSync(fd: number, atime: string | number | Date, m
|
|
|
193
192
|
* Synchronous `rmdir`.
|
|
194
193
|
* @param path
|
|
195
194
|
*/
|
|
196
|
-
export declare function rmdirSync(path: PathLike): void;
|
|
195
|
+
export declare function rmdirSync(path: fs.PathLike): void;
|
|
197
196
|
/**
|
|
198
197
|
* Synchronous `mkdir`.
|
|
199
198
|
* @param path
|
|
200
199
|
* @param mode defaults to o777
|
|
201
200
|
* @todo Implement recursion
|
|
202
201
|
*/
|
|
203
|
-
export declare function mkdirSync(path: PathLike, options:
|
|
202
|
+
export declare function mkdirSync(path: fs.PathLike, options: fs.MakeDirectoryOptions & {
|
|
204
203
|
recursive: true;
|
|
205
|
-
}): string;
|
|
206
|
-
export declare function mkdirSync(path: PathLike, options?:
|
|
204
|
+
}): string | undefined;
|
|
205
|
+
export declare function mkdirSync(path: fs.PathLike, options?: fs.Mode | (fs.MakeDirectoryOptions & {
|
|
207
206
|
recursive?: false;
|
|
208
|
-
})): void;
|
|
207
|
+
}) | null): void;
|
|
208
|
+
export declare function mkdirSync(path: fs.PathLike, options?: fs.Mode | fs.MakeDirectoryOptions | null): string | undefined;
|
|
209
209
|
/**
|
|
210
210
|
* Synchronous `readdir`. Reads the contents of a directory.
|
|
211
211
|
* @param path
|
|
212
212
|
*/
|
|
213
|
-
export declare function readdirSync(path: PathLike, options?: {
|
|
214
|
-
|
|
213
|
+
export declare function readdirSync(path: fs.PathLike, options?: {
|
|
214
|
+
recursive?: boolean;
|
|
215
|
+
encoding?: BufferEncoding | null;
|
|
215
216
|
withFileTypes?: false;
|
|
216
|
-
} | BufferEncoding): string[];
|
|
217
|
-
export declare function readdirSync(path: PathLike, options: {
|
|
217
|
+
} | BufferEncoding | null): string[];
|
|
218
|
+
export declare function readdirSync(path: fs.PathLike, options: {
|
|
219
|
+
recursive?: boolean;
|
|
218
220
|
encoding: 'buffer';
|
|
219
221
|
withFileTypes?: false;
|
|
220
222
|
} | 'buffer'): Buffer[];
|
|
221
|
-
export declare function readdirSync(path: PathLike, options: {
|
|
223
|
+
export declare function readdirSync(path: fs.PathLike, options: {
|
|
224
|
+
recursive?: boolean;
|
|
222
225
|
withFileTypes: true;
|
|
223
226
|
}): Dirent[];
|
|
227
|
+
export declare function readdirSync(path: fs.PathLike, options?: (fs.ObjectEncodingOptions & {
|
|
228
|
+
withFileTypes?: false;
|
|
229
|
+
recursive?: boolean;
|
|
230
|
+
}) | BufferEncoding | null): string[] | Buffer[];
|
|
224
231
|
/**
|
|
225
232
|
* Synchronous `link`.
|
|
226
233
|
* @param existing
|
|
227
234
|
* @param newpath
|
|
228
235
|
*/
|
|
229
|
-
export declare function linkSync(existing: PathLike, newpath: PathLike): void;
|
|
236
|
+
export declare function linkSync(existing: fs.PathLike, newpath: fs.PathLike): void;
|
|
230
237
|
/**
|
|
231
238
|
* Synchronous `symlink`.
|
|
232
239
|
* @param target target path
|
|
233
240
|
* @param path link path
|
|
234
241
|
* @param type can be either `'dir'` or `'file'` (default is `'file'`)
|
|
235
242
|
*/
|
|
236
|
-
export declare function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type): void;
|
|
243
|
+
export declare function symlinkSync(target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type | null): void;
|
|
237
244
|
/**
|
|
238
245
|
* Synchronous readlink.
|
|
239
246
|
* @param path
|
|
240
247
|
*/
|
|
241
|
-
export declare function readlinkSync(path: PathLike, options?: BufferEncodingOption): Buffer;
|
|
242
|
-
export declare function readlinkSync(path: PathLike, options: EncodingOption | BufferEncoding): string;
|
|
248
|
+
export declare function readlinkSync(path: fs.PathLike, options?: fs.BufferEncodingOption): Buffer;
|
|
249
|
+
export declare function readlinkSync(path: fs.PathLike, options: fs.EncodingOption | BufferEncoding): string;
|
|
243
250
|
/**
|
|
244
251
|
* Synchronous `chown`.
|
|
245
252
|
* @param path
|
|
246
253
|
* @param uid
|
|
247
254
|
* @param gid
|
|
248
255
|
*/
|
|
249
|
-
export declare function chownSync(path: PathLike, uid: number, gid: number): void;
|
|
256
|
+
export declare function chownSync(path: fs.PathLike, uid: number, gid: number): void;
|
|
250
257
|
/**
|
|
251
258
|
* Synchronous `lchown`.
|
|
252
259
|
* @param path
|
|
253
260
|
* @param uid
|
|
254
261
|
* @param gid
|
|
255
262
|
*/
|
|
256
|
-
export declare function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
263
|
+
export declare function lchownSync(path: fs.PathLike, uid: number, gid: number): void;
|
|
257
264
|
/**
|
|
258
265
|
* Synchronous `chmod`.
|
|
259
266
|
* @param path
|
|
260
267
|
* @param mode
|
|
261
268
|
*/
|
|
262
|
-
export declare function chmodSync(path: PathLike, mode:
|
|
269
|
+
export declare function chmodSync(path: fs.PathLike, mode: fs.Mode): void;
|
|
263
270
|
/**
|
|
264
271
|
* Synchronous `lchmod`.
|
|
265
272
|
* @param path
|
|
266
273
|
* @param mode
|
|
267
274
|
*/
|
|
268
|
-
export declare function lchmodSync(path: PathLike, mode: number | string): void;
|
|
275
|
+
export declare function lchmodSync(path: fs.PathLike, mode: number | string): void;
|
|
269
276
|
/**
|
|
270
277
|
* Change file timestamps of the file referenced by the supplied path.
|
|
271
278
|
* @param path
|
|
272
279
|
* @param atime
|
|
273
280
|
* @param mtime
|
|
274
281
|
*/
|
|
275
|
-
export declare function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
282
|
+
export declare function utimesSync(path: fs.PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
276
283
|
/**
|
|
277
284
|
* Change file timestamps of the file referenced by the supplied path.
|
|
278
285
|
* @param path
|
|
279
286
|
* @param atime
|
|
280
287
|
* @param mtime
|
|
281
288
|
*/
|
|
282
|
-
export declare function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
289
|
+
export declare function lutimesSync(path: fs.PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
283
290
|
/**
|
|
284
291
|
* Synchronous `realpath`.
|
|
285
292
|
* @param path
|
|
@@ -288,27 +295,27 @@ export declare function lutimesSync(path: PathLike, atime: string | number | Dat
|
|
|
288
295
|
* known real paths.
|
|
289
296
|
* @returns the real path
|
|
290
297
|
*/
|
|
291
|
-
export declare function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
292
|
-
export declare function realpathSync(path: PathLike, options?: EncodingOption): string;
|
|
298
|
+
export declare function realpathSync(path: fs.PathLike, options: fs.BufferEncodingOption): Buffer;
|
|
299
|
+
export declare function realpathSync(path: fs.PathLike, options?: fs.EncodingOption): string;
|
|
293
300
|
/**
|
|
294
301
|
* Synchronous `access`.
|
|
295
302
|
* @param path
|
|
296
303
|
* @param mode
|
|
297
304
|
*/
|
|
298
|
-
export declare function accessSync(path: PathLike, mode?: number): void;
|
|
305
|
+
export declare function accessSync(path: fs.PathLike, mode?: number): void;
|
|
299
306
|
/**
|
|
300
307
|
* Synchronous `rm`. Removes files or directories (recursively).
|
|
301
308
|
* @param path The path to the file or directory to remove.
|
|
302
309
|
*/
|
|
303
|
-
export declare function rmSync(path: PathLike, options?:
|
|
310
|
+
export declare function rmSync(path: fs.PathLike, options?: fs.RmOptions): void;
|
|
304
311
|
/**
|
|
305
312
|
* Synchronous `mkdtemp`. Creates a unique temporary directory.
|
|
306
313
|
* @param prefix The directory prefix.
|
|
307
314
|
* @param options The encoding (or an object including `encoding`).
|
|
308
315
|
* @returns The path to the created temporary directory, encoded as a string or buffer.
|
|
309
316
|
*/
|
|
310
|
-
export declare function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
|
|
311
|
-
export declare function mkdtempSync(prefix: string, options?: EncodingOption): string;
|
|
317
|
+
export declare function mkdtempSync(prefix: string, options: fs.BufferEncodingOption): Buffer;
|
|
318
|
+
export declare function mkdtempSync(prefix: string, options?: fs.EncodingOption): string;
|
|
312
319
|
/**
|
|
313
320
|
* Synchronous `copyFile`. Copies a file.
|
|
314
321
|
* @param src The source file.
|
|
@@ -316,7 +323,7 @@ export declare function mkdtempSync(prefix: string, options?: EncodingOption): s
|
|
|
316
323
|
* @param flags Optional flags for the copy operation. Currently supports these flags:
|
|
317
324
|
* * `fs.constants.COPYFILE_EXCL`: If the destination file already exists, the operation fails.
|
|
318
325
|
*/
|
|
319
|
-
export declare function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
|
|
326
|
+
export declare function copyFileSync(src: fs.PathLike, dest: fs.PathLike, flags?: number): void;
|
|
320
327
|
/**
|
|
321
328
|
* Synchronous `readv`. Reads from a file descriptor into multiple buffers.
|
|
322
329
|
* @param fd The file descriptor.
|
|
@@ -324,7 +331,7 @@ export declare function copyFileSync(src: PathLike, dest: PathLike, flags?: numb
|
|
|
324
331
|
* @param position The position in the file where to begin reading.
|
|
325
332
|
* @returns The number of bytes read.
|
|
326
333
|
*/
|
|
327
|
-
export declare function readvSync(fd: number, buffers: readonly
|
|
334
|
+
export declare function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
328
335
|
/**
|
|
329
336
|
* Synchronous `writev`. Writes from multiple buffers into a file descriptor.
|
|
330
337
|
* @param fd The file descriptor.
|
|
@@ -332,14 +339,14 @@ export declare function readvSync(fd: number, buffers: readonly Uint8Array[], po
|
|
|
332
339
|
* @param position The position in the file where to begin writing.
|
|
333
340
|
* @returns The number of bytes written.
|
|
334
341
|
*/
|
|
335
|
-
export declare function writevSync(fd: number, buffers: readonly
|
|
342
|
+
export declare function writevSync(fd: number, buffers: readonly ArrayBufferView[], position?: number): number;
|
|
336
343
|
/**
|
|
337
344
|
* Synchronous `opendir`. Opens a directory.
|
|
338
345
|
* @param path The path to the directory.
|
|
339
346
|
* @param options Options for opening the directory.
|
|
340
347
|
* @returns A `Dir` object representing the opened directory.
|
|
341
348
|
*/
|
|
342
|
-
export declare function opendirSync(path: PathLike, options?:
|
|
349
|
+
export declare function opendirSync(path: fs.PathLike, options?: fs.OpenDirOptions): Dir;
|
|
343
350
|
/**
|
|
344
351
|
* Synchronous `cp`. Recursively copies a file or directory.
|
|
345
352
|
* @param source The source file or directory.
|
|
@@ -352,17 +359,17 @@ export declare function opendirSync(path: PathLike, options?: Node.OpenDirOption
|
|
|
352
359
|
* * `preserveTimestamps`: Preserve file timestamps.
|
|
353
360
|
* * `recursive`: If `true`, copies directories recursively.
|
|
354
361
|
*/
|
|
355
|
-
export declare function cpSync(source: PathLike, destination: PathLike, opts?:
|
|
362
|
+
export declare function cpSync(source: fs.PathLike, destination: fs.PathLike, opts?: fs.CopySyncOptions): void;
|
|
356
363
|
/**
|
|
357
364
|
* Synchronous statfs(2). Returns information about the mounted file system which contains path.
|
|
358
365
|
* In case of an error, the err.code will be one of Common System Errors.
|
|
359
366
|
* @param path A path to an existing file or directory on the file system to be queried.
|
|
360
367
|
* @param callback
|
|
361
368
|
*/
|
|
362
|
-
export declare function statfsSync(path: PathLike, options?:
|
|
369
|
+
export declare function statfsSync(path: fs.PathLike, options?: fs.StatFsOptions & {
|
|
363
370
|
bigint?: false;
|
|
364
371
|
}): StatsFs;
|
|
365
|
-
export declare function statfsSync(path: PathLike, options:
|
|
372
|
+
export declare function statfsSync(path: fs.PathLike, options: fs.StatFsOptions & {
|
|
366
373
|
bigint: true;
|
|
367
374
|
}): BigIntStatsFs;
|
|
368
|
-
export declare function statfsSync(path: PathLike, options?:
|
|
375
|
+
export declare function statfsSync(path: fs.PathLike, options?: fs.StatFsOptions): StatsFs | BigIntStatsFs;
|