@reliverse/relifso 1.2.6 → 1.2.7
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/bin/mod.d.ts +148 -46
- package/bin/mod.js +361 -85
- package/package.json +2 -2
package/bin/mod.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Stats } from "node:fs";
|
|
2
|
-
import { accessSync, constants, readdirSync, statSync, copyFileSync } from "node:fs";
|
|
3
|
-
import { readdir as nodeReaddirInternal, stat as nodeStatInternal,
|
|
2
|
+
import { renameSync as nodeRenameSync, unlinkSync as nodeUnlinkSync, accessSync, constants, readdirSync, statSync, copyFileSync, appendFileSync, chmodSync, chownSync, closeSync, createReadStream, createWriteStream, fchmodSync, fchownSync, fdatasyncSync, fstatSync, fsyncSync, ftruncateSync, futimesSync, lchmodSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdtempSync, openSync, opendirSync, readSync, readlinkSync, realpathSync, rmSync, rmdirSync, statfsSync, symlinkSync, truncateSync, unwatchFile, utimesSync, watchFile, writeFileSync, writeSync, readvSync, writevSync } from "node:fs";
|
|
3
|
+
import { readdir as nodeReaddirInternal, stat as nodeStatInternal, rename as nodeRename, unlink as nodeUnlink, access, appendFile, chmod, chown, copyFile, lchmod, lchown, link, lstat, lutimes, mkdtemp, open, opendir, readdir, readlink, realpath, rm, rmdir, stat, statfs, symlink, truncate, utimes, watch, writeFile } from "node:fs/promises";
|
|
4
|
+
import { resolve } from "node:path";
|
|
4
5
|
import type { DiveOptions } from "./impl/dive.js";
|
|
5
6
|
import { copy, copySync } from "./impl/copy.js";
|
|
6
7
|
import { createFile, createFileSync } from "./impl/create-file.js";
|
|
@@ -14,8 +15,14 @@ import { pathExists, pathExistsSync } from "./impl/path-exists.js";
|
|
|
14
15
|
import { readFile, readFileSync } from "./impl/read-file.js";
|
|
15
16
|
import { readJson, readJsonSync } from "./impl/read-json.js";
|
|
16
17
|
import { remove, removeSync } from "./impl/remove.js";
|
|
17
|
-
import { writeFile, writeFileSync } from "./impl/write-file.js";
|
|
18
18
|
import { writeJson, writeJsonSync } from "./impl/write-json.js";
|
|
19
|
+
/**
|
|
20
|
+
* Recursively dives into a directory and yields files and directories.
|
|
21
|
+
* @param directory - The directory to dive into.
|
|
22
|
+
* @param action - An optional callback function to execute for each file or directory.
|
|
23
|
+
* @param options - An optional object containing options for the dive.
|
|
24
|
+
* @returns A Promise that resolves to an array of file paths if no action is provided, or void if an action is provided.
|
|
25
|
+
*/
|
|
19
26
|
export declare function dive(directory: string, action: (file: string, stat: Stats) => void | Promise<void>, options?: DiveOptions): Promise<void>;
|
|
20
27
|
export declare function dive(directory: string, options?: DiveOptions): Promise<string[]>;
|
|
21
28
|
declare const mkdirp: typeof mkdirs;
|
|
@@ -40,72 +47,167 @@ declare const writeJSON: typeof writeJson;
|
|
|
40
47
|
declare const writeJSONSync: typeof writeJsonSync;
|
|
41
48
|
declare const outputJSON: typeof outputJson;
|
|
42
49
|
declare const outputJSONSync: typeof outputJsonSync;
|
|
50
|
+
declare const cp: typeof copy;
|
|
51
|
+
declare const cpSync: typeof copySync;
|
|
52
|
+
declare const exists: typeof pathExists;
|
|
53
|
+
declare const existsSync: typeof pathExistsSync;
|
|
54
|
+
declare function readText(filePath: string, options?: BufferEncoding | {
|
|
55
|
+
encoding?: BufferEncoding | null;
|
|
56
|
+
flag?: string;
|
|
57
|
+
}): Promise<string>;
|
|
58
|
+
declare function readTextSync(filePath: string, options?: BufferEncoding | {
|
|
59
|
+
encoding?: BufferEncoding | null;
|
|
60
|
+
flag?: string;
|
|
61
|
+
}): string;
|
|
62
|
+
declare function readLines(filePath: string, options?: BufferEncoding | {
|
|
63
|
+
encoding?: BufferEncoding | null;
|
|
64
|
+
flag?: string;
|
|
65
|
+
}): Promise<any>;
|
|
66
|
+
declare function readLinesSync(filePath: string, options?: BufferEncoding | {
|
|
67
|
+
encoding?: BufferEncoding | null;
|
|
68
|
+
flag?: string;
|
|
69
|
+
}): any;
|
|
70
|
+
declare function isDirectory(filePath: string): Promise<boolean>;
|
|
71
|
+
declare function isDirectorySync(filePath: string): boolean;
|
|
72
|
+
declare function isSymlink(filePath: string): Promise<boolean>;
|
|
73
|
+
declare function isSymlinkSync(filePath: string): boolean;
|
|
43
74
|
export type { CopyOptions } from "./impl/copy.js";
|
|
44
75
|
export type { MoveOptions } from "./impl/move.js";
|
|
45
76
|
export type { ReadFileOptions } from "./impl/read-file.js";
|
|
46
77
|
export type { ReadJsonOptions } from "./impl/read-json.js";
|
|
47
78
|
export type { JsonStringifyOptions } from "./impl/write-json.js";
|
|
48
79
|
export type { WriteJsonOptions } from "./impl/write-json.js";
|
|
49
|
-
export {
|
|
80
|
+
export { accessSync, appendFileSync, chmodSync, chownSync, closeSync, copyFileSync, createReadStream, createWriteStream, fchmodSync, fchownSync, fdatasyncSync, fstatSync, fsyncSync, ftruncateSync, futimesSync, lchmodSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdtempSync, openSync, opendirSync, readFileSync, readlinkSync, readSync, readdirSync, realpathSync, nodeRenameSync, rmSync, rmdirSync, statSync, statfsSync, symlinkSync, truncateSync, nodeUnlinkSync, unwatchFile, utimesSync, watchFile, writeFileSync, writeSync, readvSync, writevSync, readJsonSync, writeJsonSync, createFileSync, mkdirsSync, emptyDirSync, pathExistsSync, copySync, moveSync, removeSync, outputJsonSync, outputFileSync, diveSync, cpSync, ensureDirSync, ensureFileSync, existsSync, mkdirpSync, mkdirSync, ncpSync, outputJSONSync, readJSONSync, renameSync, rimrafSync, unlinkSync, writeJSONSync, isDirectorySync, isSymlinkSync, readLinesSync, readTextSync, readJson, writeJson, createFile, mkdirs, emptyDir, pathExists, copy, move, remove, outputJson, outputFile, access, appendFile, chmod, chown, copyFile, lchmod, lchown, link, lstat, lutimes, mkdtemp, open, opendir, readFile, readdir, readlink, realpath, nodeRename, rm, rmdir, stat, statfs, symlink, truncate, nodeUnlink, utimes, watch, writeFile, constants, cp, ensureDir, ensureFile, exists, mkdir, mkdirp, ncp, outputJSON, readJSON, rename, resolve, rimraf, unlink, writeJSON, isDirectory, isSymlink, readLines, readText, };
|
|
50
81
|
declare const fs: {
|
|
82
|
+
accessSync: typeof accessSync;
|
|
83
|
+
appendFileSync: typeof appendFileSync;
|
|
84
|
+
chmodSync: typeof chmodSync;
|
|
85
|
+
chownSync: typeof chownSync;
|
|
86
|
+
closeSync: typeof closeSync;
|
|
87
|
+
copyFileSync: typeof copyFileSync;
|
|
88
|
+
createReadStream: typeof createReadStream;
|
|
89
|
+
createWriteStream: typeof createWriteStream;
|
|
90
|
+
fchmodSync: typeof fchmodSync;
|
|
91
|
+
fchownSync: typeof fchownSync;
|
|
92
|
+
fdatasyncSync: typeof fdatasyncSync;
|
|
93
|
+
fstatSync: typeof fstatSync;
|
|
94
|
+
fsyncSync: typeof fsyncSync;
|
|
95
|
+
ftruncateSync: typeof ftruncateSync;
|
|
96
|
+
futimesSync: typeof futimesSync;
|
|
97
|
+
lchmodSync: typeof lchmodSync;
|
|
98
|
+
lchownSync: typeof lchownSync;
|
|
99
|
+
linkSync: typeof linkSync;
|
|
100
|
+
lstatSync: import("fs").StatSyncFn;
|
|
101
|
+
lutimesSync: typeof lutimesSync;
|
|
102
|
+
mkdtempSync: typeof mkdtempSync;
|
|
103
|
+
openSync: typeof openSync;
|
|
104
|
+
opendirSync: typeof opendirSync;
|
|
105
|
+
readFileSync: typeof readFileSync;
|
|
106
|
+
readlinkSync: typeof readlinkSync;
|
|
107
|
+
readSync: typeof readSync;
|
|
108
|
+
readdirSync: typeof readdirSync;
|
|
109
|
+
realpathSync: typeof realpathSync;
|
|
110
|
+
nodeRenameSync: typeof nodeRenameSync;
|
|
111
|
+
rmSync: typeof rmSync;
|
|
112
|
+
rmdirSync: typeof rmdirSync;
|
|
113
|
+
statSync: import("fs").StatSyncFn;
|
|
114
|
+
statfsSync: typeof statfsSync;
|
|
115
|
+
symlinkSync: typeof symlinkSync;
|
|
116
|
+
truncateSync: typeof truncateSync;
|
|
117
|
+
nodeUnlinkSync: typeof nodeUnlinkSync;
|
|
118
|
+
unwatchFile: typeof unwatchFile;
|
|
119
|
+
utimesSync: typeof utimesSync;
|
|
120
|
+
watchFile: typeof watchFile;
|
|
121
|
+
writeFileSync: typeof writeFileSync;
|
|
122
|
+
writeSync: typeof writeSync;
|
|
123
|
+
readvSync: typeof readvSync;
|
|
124
|
+
writevSync: typeof writevSync;
|
|
125
|
+
readJsonSync: typeof readJsonSync;
|
|
126
|
+
writeJsonSync: typeof writeJsonSync;
|
|
127
|
+
createFileSync: typeof createFileSync;
|
|
128
|
+
mkdirsSync: typeof mkdirsSync;
|
|
129
|
+
emptyDirSync: typeof emptyDirSync;
|
|
130
|
+
pathExistsSync: typeof pathExistsSync;
|
|
131
|
+
copySync: typeof copySync;
|
|
132
|
+
moveSync: typeof moveSync;
|
|
133
|
+
removeSync: typeof removeSync;
|
|
134
|
+
outputJsonSync: typeof outputJsonSync;
|
|
135
|
+
outputFileSync: typeof outputFileSync;
|
|
136
|
+
diveSync: typeof diveSync;
|
|
137
|
+
cpSync: typeof copySync;
|
|
138
|
+
ensureDirSync: typeof mkdirsSync;
|
|
139
|
+
ensureFileSync: typeof createFileSync;
|
|
140
|
+
existsSync: typeof pathExistsSync;
|
|
141
|
+
mkdirpSync: typeof mkdirsSync;
|
|
142
|
+
mkdirSync: typeof mkdirsSync;
|
|
143
|
+
ncpSync: typeof copySync;
|
|
144
|
+
outputJSONSync: typeof outputJsonSync;
|
|
145
|
+
readJSONSync: typeof readJsonSync;
|
|
146
|
+
renameSync: typeof moveSync;
|
|
147
|
+
rimrafSync: typeof removeSync;
|
|
148
|
+
unlinkSync: typeof removeSync;
|
|
149
|
+
writeJSONSync: typeof writeJsonSync;
|
|
150
|
+
isDirectorySync: typeof isDirectorySync;
|
|
151
|
+
isSymlinkSync: typeof isSymlinkSync;
|
|
152
|
+
readLinesSync: typeof readLinesSync;
|
|
153
|
+
readTextSync: typeof readTextSync;
|
|
51
154
|
readJson: typeof readJson;
|
|
52
155
|
writeJson: typeof writeJson;
|
|
53
156
|
createFile: typeof createFile;
|
|
54
|
-
writeFile: typeof writeFile;
|
|
55
|
-
readFile: typeof readFile;
|
|
56
157
|
mkdirs: typeof mkdirs;
|
|
57
158
|
emptyDir: typeof emptyDir;
|
|
58
159
|
pathExists: typeof pathExists;
|
|
59
160
|
copy: typeof copy;
|
|
60
161
|
move: typeof move;
|
|
61
162
|
remove: typeof remove;
|
|
62
|
-
|
|
63
|
-
|
|
163
|
+
outputJson: typeof outputJson;
|
|
164
|
+
outputFile: typeof outputFile;
|
|
64
165
|
access: typeof access;
|
|
166
|
+
appendFile: typeof appendFile;
|
|
167
|
+
chmod: typeof chmod;
|
|
168
|
+
chown: typeof chown;
|
|
65
169
|
copyFile: typeof copyFile;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
170
|
+
lchmod: typeof lchmod;
|
|
171
|
+
lchown: typeof lchown;
|
|
172
|
+
link: typeof link;
|
|
173
|
+
lstat: typeof lstat;
|
|
174
|
+
lutimes: typeof lutimes;
|
|
175
|
+
mkdtemp: typeof mkdtemp;
|
|
176
|
+
open: typeof open;
|
|
177
|
+
opendir: typeof opendir;
|
|
178
|
+
readFile: typeof readFile;
|
|
179
|
+
readdir: typeof nodeReaddirInternal;
|
|
180
|
+
readlink: typeof readlink;
|
|
181
|
+
realpath: typeof realpath;
|
|
182
|
+
nodeRename: typeof nodeRename;
|
|
183
|
+
rm: typeof rm;
|
|
184
|
+
rmdir: typeof rmdir;
|
|
185
|
+
stat: typeof nodeStatInternal;
|
|
186
|
+
statfs: typeof statfs;
|
|
187
|
+
symlink: typeof symlink;
|
|
188
|
+
truncate: typeof truncate;
|
|
189
|
+
nodeUnlink: typeof nodeUnlink;
|
|
190
|
+
utimes: typeof utimes;
|
|
191
|
+
watch: typeof watch;
|
|
192
|
+
writeFile: typeof writeFile;
|
|
80
193
|
constants: typeof constants;
|
|
81
|
-
|
|
82
|
-
mkdirp: typeof mkdirs;
|
|
83
|
-
mkdirpSync: typeof mkdirsSync;
|
|
84
|
-
rimraf: typeof remove;
|
|
85
|
-
rimrafSync: typeof removeSync;
|
|
86
|
-
ncp: typeof copy;
|
|
87
|
-
ncpSync: typeof copySync;
|
|
194
|
+
cp: typeof copy;
|
|
88
195
|
ensureDir: typeof mkdirs;
|
|
89
|
-
ensureDirSync: typeof mkdirsSync;
|
|
90
196
|
ensureFile: typeof createFile;
|
|
91
|
-
|
|
92
|
-
outputJson: typeof outputJson;
|
|
93
|
-
outputJsonSync: typeof outputJsonSync;
|
|
94
|
-
outputFile: typeof outputFile;
|
|
95
|
-
outputFileSync: typeof outputFileSync;
|
|
96
|
-
dive: typeof dive;
|
|
97
|
-
diveSync: typeof diveSync;
|
|
197
|
+
exists: typeof pathExists;
|
|
98
198
|
mkdir: typeof mkdirs;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
rename: typeof move;
|
|
103
|
-
renameSync: typeof moveSync;
|
|
199
|
+
mkdirp: typeof mkdirs;
|
|
200
|
+
ncp: typeof copy;
|
|
201
|
+
outputJSON: typeof outputJson;
|
|
104
202
|
readJSON: typeof readJson;
|
|
105
|
-
|
|
203
|
+
rename: typeof move;
|
|
204
|
+
resolve: (...paths: string[]) => string;
|
|
205
|
+
rimraf: typeof remove;
|
|
206
|
+
unlink: typeof remove;
|
|
106
207
|
writeJSON: typeof writeJson;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
208
|
+
isDirectory: typeof isDirectory;
|
|
209
|
+
isSymlink: typeof isSymlink;
|
|
210
|
+
readLines: typeof readLines;
|
|
211
|
+
readText: typeof readText;
|
|
110
212
|
};
|
|
111
213
|
export default fs;
|
package/bin/mod.js
CHANGED
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
renameSync as nodeRenameSync,
|
|
3
|
+
unlinkSync as nodeUnlinkSync,
|
|
4
|
+
accessSync,
|
|
5
|
+
constants,
|
|
6
|
+
readdirSync,
|
|
7
|
+
statSync,
|
|
8
|
+
copyFileSync,
|
|
9
|
+
appendFileSync,
|
|
10
|
+
chmodSync,
|
|
11
|
+
chownSync,
|
|
12
|
+
closeSync,
|
|
13
|
+
createReadStream,
|
|
14
|
+
createWriteStream,
|
|
15
|
+
fchmodSync,
|
|
16
|
+
fchownSync,
|
|
17
|
+
fdatasyncSync,
|
|
18
|
+
fstatSync,
|
|
19
|
+
fsyncSync,
|
|
20
|
+
ftruncateSync,
|
|
21
|
+
futimesSync,
|
|
22
|
+
lchmodSync,
|
|
23
|
+
lchownSync,
|
|
24
|
+
linkSync,
|
|
25
|
+
lstatSync,
|
|
26
|
+
lutimesSync,
|
|
27
|
+
mkdtempSync,
|
|
28
|
+
openSync,
|
|
29
|
+
opendirSync,
|
|
30
|
+
readSync,
|
|
31
|
+
readlinkSync,
|
|
32
|
+
realpathSync,
|
|
33
|
+
rmSync,
|
|
34
|
+
rmdirSync,
|
|
35
|
+
statfsSync,
|
|
36
|
+
symlinkSync,
|
|
37
|
+
truncateSync,
|
|
38
|
+
unwatchFile,
|
|
39
|
+
utimesSync,
|
|
40
|
+
watchFile,
|
|
41
|
+
writeFileSync,
|
|
42
|
+
writeSync,
|
|
43
|
+
readvSync,
|
|
44
|
+
writevSync
|
|
45
|
+
} from "node:fs";
|
|
2
46
|
import {
|
|
3
47
|
readdir as nodeReaddirInternal,
|
|
4
48
|
stat as nodeStatInternal,
|
|
49
|
+
rename as nodeRename,
|
|
50
|
+
unlink as nodeUnlink,
|
|
51
|
+
access,
|
|
52
|
+
appendFile,
|
|
53
|
+
chmod,
|
|
54
|
+
chown,
|
|
55
|
+
copyFile,
|
|
56
|
+
lchmod,
|
|
57
|
+
lchown,
|
|
58
|
+
link,
|
|
59
|
+
lstat,
|
|
60
|
+
lutimes,
|
|
61
|
+
mkdtemp,
|
|
62
|
+
open,
|
|
63
|
+
opendir,
|
|
5
64
|
readdir,
|
|
65
|
+
readlink,
|
|
66
|
+
realpath,
|
|
67
|
+
rm,
|
|
68
|
+
rmdir,
|
|
6
69
|
stat,
|
|
7
|
-
|
|
8
|
-
|
|
70
|
+
statfs,
|
|
71
|
+
symlink,
|
|
72
|
+
truncate,
|
|
73
|
+
utimes,
|
|
74
|
+
watch,
|
|
75
|
+
writeFile
|
|
9
76
|
} from "node:fs/promises";
|
|
10
|
-
import { join as pathJoin } from "node:path";
|
|
77
|
+
import { join as pathJoin, resolve } from "node:path";
|
|
11
78
|
import { copy, copySync } from "./impl/copy.js";
|
|
12
79
|
import { createFile, createFileSync } from "./impl/create-file.js";
|
|
13
80
|
import { diveSync } from "./impl/dive.js";
|
|
@@ -20,7 +87,6 @@ import { pathExists, pathExistsSync } from "./impl/path-exists.js";
|
|
|
20
87
|
import { readFile, readFileSync } from "./impl/read-file.js";
|
|
21
88
|
import { readJson, readJsonSync } from "./impl/read-json.js";
|
|
22
89
|
import { remove, removeSync } from "./impl/remove.js";
|
|
23
|
-
import { writeFile, writeFileSync } from "./impl/write-file.js";
|
|
24
90
|
import { writeJson, writeJsonSync } from "./impl/write-json.js";
|
|
25
91
|
async function* _diveWorker(currentPath, options, currentDepth) {
|
|
26
92
|
const maxDepth = options.depth ?? Number.POSITIVE_INFINITY;
|
|
@@ -121,129 +187,339 @@ const writeJSON = writeJson;
|
|
|
121
187
|
const writeJSONSync = writeJsonSync;
|
|
122
188
|
const outputJSON = outputJson;
|
|
123
189
|
const outputJSONSync = outputJsonSync;
|
|
190
|
+
const cp = copy;
|
|
191
|
+
const cpSync = copySync;
|
|
192
|
+
const exists = pathExists;
|
|
193
|
+
const existsSync = pathExistsSync;
|
|
194
|
+
async function readText(filePath, options = "utf8") {
|
|
195
|
+
return readFile(filePath, options);
|
|
196
|
+
}
|
|
197
|
+
function readTextSync(filePath, options = "utf8") {
|
|
198
|
+
return readFileSync(filePath, options);
|
|
199
|
+
}
|
|
200
|
+
async function readLines(filePath, options = { encoding: "utf8" }) {
|
|
201
|
+
const effectiveOptions = typeof options === "string" ? { encoding: options } : options;
|
|
202
|
+
const contentBuffer = await readFile(filePath, { ...effectiveOptions, encoding: null });
|
|
203
|
+
return contentBuffer.split(/\r?\n/);
|
|
204
|
+
}
|
|
205
|
+
function readLinesSync(filePath, options = { encoding: "utf8" }) {
|
|
206
|
+
const effectiveOptions = typeof options === "string" ? { encoding: options } : options;
|
|
207
|
+
const contentBuffer = readFileSync(filePath, { ...effectiveOptions, encoding: null });
|
|
208
|
+
const content = contentBuffer;
|
|
209
|
+
return content.split(/\r?\n/);
|
|
210
|
+
}
|
|
211
|
+
async function isDirectory(filePath) {
|
|
212
|
+
try {
|
|
213
|
+
const stats = await stat(filePath);
|
|
214
|
+
return stats.isDirectory();
|
|
215
|
+
} catch (error) {
|
|
216
|
+
if (error.code === "ENOENT" || error.code === "ENOTDIR") {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function isDirectorySync(filePath) {
|
|
223
|
+
try {
|
|
224
|
+
const stats = statSync(filePath);
|
|
225
|
+
return stats.isDirectory();
|
|
226
|
+
} catch (error) {
|
|
227
|
+
if (error.code === "ENOENT" || error.code === "ENOTDIR") {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async function isSymlink(filePath) {
|
|
234
|
+
try {
|
|
235
|
+
const stats = await lstat(filePath);
|
|
236
|
+
return stats.isSymbolicLink();
|
|
237
|
+
} catch (error) {
|
|
238
|
+
if (error.code === "ENOENT") {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function isSymlinkSync(filePath) {
|
|
245
|
+
try {
|
|
246
|
+
const stats = lstatSync(filePath);
|
|
247
|
+
return stats.isSymbolicLink();
|
|
248
|
+
} catch (error) {
|
|
249
|
+
if (error.code === "ENOENT") {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
124
255
|
export {
|
|
256
|
+
accessSync,
|
|
257
|
+
appendFileSync,
|
|
258
|
+
chmodSync,
|
|
259
|
+
chownSync,
|
|
260
|
+
closeSync,
|
|
261
|
+
copyFileSync,
|
|
262
|
+
createReadStream,
|
|
263
|
+
createWriteStream,
|
|
264
|
+
fchmodSync,
|
|
265
|
+
fchownSync,
|
|
266
|
+
fdatasyncSync,
|
|
267
|
+
fstatSync,
|
|
268
|
+
fsyncSync,
|
|
269
|
+
ftruncateSync,
|
|
270
|
+
futimesSync,
|
|
271
|
+
lchmodSync,
|
|
272
|
+
lchownSync,
|
|
273
|
+
linkSync,
|
|
274
|
+
lstatSync,
|
|
275
|
+
lutimesSync,
|
|
276
|
+
mkdtempSync,
|
|
277
|
+
openSync,
|
|
278
|
+
opendirSync,
|
|
279
|
+
readFileSync,
|
|
280
|
+
readlinkSync,
|
|
281
|
+
readSync,
|
|
282
|
+
readdirSync,
|
|
283
|
+
realpathSync,
|
|
284
|
+
nodeRenameSync,
|
|
285
|
+
rmSync,
|
|
286
|
+
rmdirSync,
|
|
287
|
+
statSync,
|
|
288
|
+
statfsSync,
|
|
289
|
+
symlinkSync,
|
|
290
|
+
truncateSync,
|
|
291
|
+
nodeUnlinkSync,
|
|
292
|
+
unwatchFile,
|
|
293
|
+
utimesSync,
|
|
294
|
+
watchFile,
|
|
295
|
+
writeFileSync,
|
|
296
|
+
writeSync,
|
|
297
|
+
readvSync,
|
|
298
|
+
writevSync,
|
|
299
|
+
readJsonSync,
|
|
300
|
+
writeJsonSync,
|
|
301
|
+
createFileSync,
|
|
302
|
+
mkdirsSync,
|
|
303
|
+
emptyDirSync,
|
|
304
|
+
pathExistsSync,
|
|
305
|
+
copySync,
|
|
306
|
+
moveSync,
|
|
307
|
+
removeSync,
|
|
308
|
+
outputJsonSync,
|
|
309
|
+
outputFileSync,
|
|
310
|
+
diveSync,
|
|
311
|
+
cpSync,
|
|
312
|
+
ensureDirSync,
|
|
313
|
+
ensureFileSync,
|
|
314
|
+
existsSync,
|
|
315
|
+
mkdirpSync,
|
|
316
|
+
mkdirSync,
|
|
317
|
+
ncpSync,
|
|
318
|
+
outputJSONSync,
|
|
319
|
+
readJSONSync,
|
|
320
|
+
renameSync,
|
|
321
|
+
rimrafSync,
|
|
322
|
+
unlinkSync,
|
|
323
|
+
writeJSONSync,
|
|
324
|
+
isDirectorySync,
|
|
325
|
+
isSymlinkSync,
|
|
326
|
+
readLinesSync,
|
|
327
|
+
readTextSync,
|
|
125
328
|
readJson,
|
|
126
329
|
writeJson,
|
|
127
330
|
createFile,
|
|
128
|
-
writeFile,
|
|
129
|
-
readFile,
|
|
130
331
|
mkdirs,
|
|
131
332
|
emptyDir,
|
|
132
333
|
pathExists,
|
|
133
334
|
copy,
|
|
134
335
|
move,
|
|
135
336
|
remove,
|
|
136
|
-
|
|
137
|
-
|
|
337
|
+
outputJson,
|
|
338
|
+
outputFile,
|
|
138
339
|
access,
|
|
340
|
+
appendFile,
|
|
341
|
+
chmod,
|
|
342
|
+
chown,
|
|
139
343
|
copyFile,
|
|
344
|
+
lchmod,
|
|
345
|
+
lchown,
|
|
346
|
+
link,
|
|
347
|
+
lstat,
|
|
348
|
+
lutimes,
|
|
349
|
+
mkdtemp,
|
|
350
|
+
open,
|
|
351
|
+
opendir,
|
|
352
|
+
readFile,
|
|
353
|
+
readdir,
|
|
354
|
+
readlink,
|
|
355
|
+
realpath,
|
|
356
|
+
nodeRename,
|
|
357
|
+
rm,
|
|
358
|
+
rmdir,
|
|
359
|
+
stat,
|
|
360
|
+
statfs,
|
|
361
|
+
symlink,
|
|
362
|
+
truncate,
|
|
363
|
+
nodeUnlink,
|
|
364
|
+
utimes,
|
|
365
|
+
watch,
|
|
366
|
+
writeFile,
|
|
367
|
+
constants,
|
|
368
|
+
cp,
|
|
369
|
+
ensureDir,
|
|
370
|
+
ensureFile,
|
|
371
|
+
exists,
|
|
372
|
+
mkdir,
|
|
373
|
+
mkdirp,
|
|
374
|
+
ncp,
|
|
375
|
+
outputJSON,
|
|
376
|
+
readJSON,
|
|
377
|
+
rename,
|
|
378
|
+
resolve,
|
|
379
|
+
rimraf,
|
|
380
|
+
unlink,
|
|
381
|
+
writeJSON,
|
|
382
|
+
isDirectory,
|
|
383
|
+
isSymlink,
|
|
384
|
+
readLines,
|
|
385
|
+
readText
|
|
386
|
+
};
|
|
387
|
+
const fs = {
|
|
388
|
+
// Sync direct exports (node:fs)
|
|
389
|
+
accessSync,
|
|
390
|
+
appendFileSync,
|
|
391
|
+
chmodSync,
|
|
392
|
+
chownSync,
|
|
393
|
+
closeSync,
|
|
394
|
+
copyFileSync,
|
|
395
|
+
createReadStream,
|
|
396
|
+
createWriteStream,
|
|
397
|
+
fchmodSync,
|
|
398
|
+
fchownSync,
|
|
399
|
+
fdatasyncSync,
|
|
400
|
+
fstatSync,
|
|
401
|
+
fsyncSync,
|
|
402
|
+
ftruncateSync,
|
|
403
|
+
futimesSync,
|
|
404
|
+
lchmodSync,
|
|
405
|
+
lchownSync,
|
|
406
|
+
linkSync,
|
|
407
|
+
lstatSync,
|
|
408
|
+
lutimesSync,
|
|
409
|
+
mkdtempSync,
|
|
410
|
+
openSync,
|
|
411
|
+
opendirSync,
|
|
412
|
+
readFileSync,
|
|
413
|
+
readlinkSync,
|
|
414
|
+
readSync,
|
|
415
|
+
readdirSync,
|
|
416
|
+
realpathSync,
|
|
417
|
+
nodeRenameSync,
|
|
418
|
+
rmSync,
|
|
419
|
+
rmdirSync,
|
|
420
|
+
statSync,
|
|
421
|
+
statfsSync,
|
|
422
|
+
symlinkSync,
|
|
423
|
+
truncateSync,
|
|
424
|
+
nodeUnlinkSync,
|
|
425
|
+
unwatchFile,
|
|
426
|
+
utimesSync,
|
|
427
|
+
watchFile,
|
|
428
|
+
writeFileSync,
|
|
429
|
+
writeSync,
|
|
430
|
+
readvSync,
|
|
431
|
+
writevSync,
|
|
140
432
|
readJsonSync,
|
|
141
433
|
writeJsonSync,
|
|
142
434
|
createFileSync,
|
|
143
|
-
writeFileSync,
|
|
144
|
-
readFileSync,
|
|
145
435
|
mkdirsSync,
|
|
146
436
|
emptyDirSync,
|
|
147
437
|
pathExistsSync,
|
|
148
438
|
copySync,
|
|
149
439
|
moveSync,
|
|
150
440
|
removeSync,
|
|
151
|
-
readdirSync,
|
|
152
|
-
statSync,
|
|
153
|
-
accessSync,
|
|
154
|
-
constants,
|
|
155
|
-
copyFileSync,
|
|
156
|
-
mkdirp,
|
|
157
|
-
mkdirpSync,
|
|
158
|
-
rimraf,
|
|
159
|
-
rimrafSync,
|
|
160
|
-
ncp,
|
|
161
|
-
ncpSync,
|
|
162
|
-
ensureDir,
|
|
163
|
-
ensureDirSync,
|
|
164
|
-
ensureFile,
|
|
165
|
-
ensureFileSync,
|
|
166
|
-
outputJson,
|
|
167
441
|
outputJsonSync,
|
|
168
|
-
outputFile,
|
|
169
442
|
outputFileSync,
|
|
170
443
|
diveSync,
|
|
171
|
-
|
|
444
|
+
// Sync aliases
|
|
445
|
+
cpSync,
|
|
446
|
+
ensureDirSync,
|
|
447
|
+
ensureFileSync,
|
|
448
|
+
existsSync,
|
|
449
|
+
mkdirpSync,
|
|
172
450
|
mkdirSync,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
rename,
|
|
176
|
-
renameSync,
|
|
177
|
-
readJSON,
|
|
451
|
+
ncpSync,
|
|
452
|
+
outputJSONSync,
|
|
178
453
|
readJSONSync,
|
|
179
|
-
|
|
454
|
+
renameSync,
|
|
455
|
+
rimrafSync,
|
|
456
|
+
unlinkSync,
|
|
180
457
|
writeJSONSync,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
458
|
+
// Simple sync custom implementations
|
|
459
|
+
isDirectorySync,
|
|
460
|
+
isSymlinkSync,
|
|
461
|
+
readLinesSync,
|
|
462
|
+
readTextSync,
|
|
463
|
+
// Async direct exports (node:fs/promises)
|
|
186
464
|
readJson,
|
|
187
465
|
writeJson,
|
|
188
466
|
createFile,
|
|
189
|
-
writeFile,
|
|
190
|
-
readFile,
|
|
191
467
|
mkdirs,
|
|
192
468
|
emptyDir,
|
|
193
469
|
pathExists,
|
|
194
470
|
copy,
|
|
195
471
|
move,
|
|
196
472
|
remove,
|
|
197
|
-
|
|
198
|
-
|
|
473
|
+
outputJson,
|
|
474
|
+
outputFile,
|
|
199
475
|
access,
|
|
476
|
+
appendFile,
|
|
477
|
+
chmod,
|
|
478
|
+
chown,
|
|
200
479
|
copyFile,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
480
|
+
lchmod,
|
|
481
|
+
lchown,
|
|
482
|
+
link,
|
|
483
|
+
lstat,
|
|
484
|
+
lutimes,
|
|
485
|
+
mkdtemp,
|
|
486
|
+
open,
|
|
487
|
+
opendir,
|
|
488
|
+
readFile,
|
|
489
|
+
readdir,
|
|
490
|
+
readlink,
|
|
491
|
+
realpath,
|
|
492
|
+
nodeRename,
|
|
493
|
+
rm,
|
|
494
|
+
rmdir,
|
|
495
|
+
stat,
|
|
496
|
+
statfs,
|
|
497
|
+
symlink,
|
|
498
|
+
truncate,
|
|
499
|
+
nodeUnlink,
|
|
500
|
+
utimes,
|
|
501
|
+
watch,
|
|
502
|
+
writeFile,
|
|
503
|
+
// Async aliases
|
|
216
504
|
constants,
|
|
217
|
-
|
|
218
|
-
// alias
|
|
219
|
-
mkdirp,
|
|
220
|
-
mkdirpSync,
|
|
221
|
-
rimraf,
|
|
222
|
-
rimrafSync,
|
|
223
|
-
ncp,
|
|
224
|
-
ncpSync,
|
|
505
|
+
cp,
|
|
225
506
|
ensureDir,
|
|
226
|
-
ensureDirSync,
|
|
227
507
|
ensureFile,
|
|
228
|
-
|
|
229
|
-
outputJson,
|
|
230
|
-
outputJsonSync,
|
|
231
|
-
outputFile,
|
|
232
|
-
outputFileSync,
|
|
233
|
-
dive,
|
|
234
|
-
diveSync,
|
|
508
|
+
exists,
|
|
235
509
|
mkdir,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
rename,
|
|
240
|
-
renameSync,
|
|
241
|
-
// ADDED JSON Aliases
|
|
510
|
+
mkdirp,
|
|
511
|
+
ncp,
|
|
512
|
+
outputJSON,
|
|
242
513
|
readJSON,
|
|
243
|
-
|
|
514
|
+
rename,
|
|
515
|
+
resolve,
|
|
516
|
+
rimraf,
|
|
517
|
+
unlink,
|
|
244
518
|
writeJSON,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
519
|
+
// Simple async custom implementations
|
|
520
|
+
isDirectory,
|
|
521
|
+
isSymlink,
|
|
522
|
+
readLines,
|
|
523
|
+
readText
|
|
248
524
|
};
|
|
249
525
|
export default fs;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"name": "@reliverse/relifso",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"version": "1.2.
|
|
8
|
+
"version": "1.2.7",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"fs",
|
|
11
11
|
"file",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"klaw-sync": "^7.0.0",
|
|
71
71
|
"knip": "^5.56.0",
|
|
72
72
|
"minimist": "^1.2.8",
|
|
73
|
-
"mocha": "^11.
|
|
73
|
+
"mocha": "^11.4.0",
|
|
74
74
|
"nyc": "^17.1.0",
|
|
75
75
|
"proxyquire": "^2.1.3",
|
|
76
76
|
"read-dir-files": "^0.1.1",
|