@d0paminedriven/fs 6.0.0 → 6.0.1
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/chunk-4X5DVWVM.js +14 -0
- package/dist/{chunk-KZWE4E4I.js → chunk-73BXX52B.js} +151 -22
- package/dist/fs/index.cjs +157 -21
- package/dist/fs/index.d.cts +79 -2
- package/dist/fs/index.d.ts +79 -2
- package/dist/fs/index.js +2 -1
- package/dist/index.cjs +161 -23
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/types/index.cjs +19 -0
- package/dist/types/index.d.cts +19 -3
- package/dist/types/index.d.ts +19 -3
- package/dist/types/index.js +7 -0
- package/package.json +3 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MimeService
|
|
3
3
|
} from "./chunk-EHOBCDHE.js";
|
|
4
|
+
import {
|
|
5
|
+
unitsObj
|
|
6
|
+
} from "./chunk-4X5DVWVM.js";
|
|
4
7
|
import {
|
|
5
8
|
__name
|
|
6
9
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -28,14 +31,84 @@ var Fs = class extends MimeService {
|
|
|
28
31
|
parseDotEnv() {
|
|
29
32
|
return expand.expand(this.myEnv);
|
|
30
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param target path to the file or directory to check for existence
|
|
37
|
+
* @returns true if the file or directory exists, false otherwise
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const fs = new Fs(process.cwd());
|
|
41
|
+
* const exists = fs.exists("my-file.txt");
|
|
42
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
43
|
+
* ```
|
|
44
|
+
* @description
|
|
45
|
+
* This method checks if a file or directory exists at the specified path input
|
|
46
|
+
*
|
|
47
|
+
* Additional Note:
|
|
48
|
+
*
|
|
49
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
50
|
+
*
|
|
51
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
31
54
|
exists(target) {
|
|
32
|
-
if (!/\//gm.test(target))
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
if (!/\//gm.test(target)) {
|
|
56
|
+
if (/\./g.test(target)) {
|
|
57
|
+
return fsSync.existsSync(resolve(join(this.cwd, target)));
|
|
58
|
+
} else {
|
|
59
|
+
const statsSync = fsSync.statSync(resolve(join(this.cwd, target)), {
|
|
60
|
+
throwIfNoEntry: false
|
|
61
|
+
});
|
|
62
|
+
const isDir = statsSync?.isDirectory();
|
|
63
|
+
if (isDir) {
|
|
64
|
+
return isDir;
|
|
65
|
+
} else return false;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if (/\./g.test(target)) {
|
|
69
|
+
return fsSync.existsSync(relative(this.cwd ?? process.cwd(), target));
|
|
70
|
+
} else {
|
|
71
|
+
const statsSync = fsSync.statSync(relative(this.cwd, target), {
|
|
72
|
+
throwIfNoEntry: false
|
|
73
|
+
});
|
|
74
|
+
const isDir = statsSync?.isDirectory();
|
|
75
|
+
if (isDir) {
|
|
76
|
+
return isDir;
|
|
77
|
+
} else return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
35
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param ms milliseconds to wait
|
|
84
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const fs = new Fs(process.cwd());
|
|
88
|
+
* await fs.wait(1000); // waits for 1 second
|
|
89
|
+
* console.log("Done waiting!");
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Alternatively, you can use it like this:
|
|
93
|
+
* ```ts
|
|
94
|
+
* const fs = new Fs(process.cwd());
|
|
95
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
96
|
+
* console.log("Done waiting!");
|
|
97
|
+
* // do something after waiting
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @description
|
|
102
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
103
|
+
*/
|
|
36
104
|
wait(ms) {
|
|
37
105
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
38
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
109
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
110
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
111
|
+
*/
|
|
39
112
|
handleBuffStrArrUnion(arr) {
|
|
40
113
|
return arr.map(
|
|
41
114
|
(v) => Buffer.isBuffer(v) ? Buffer.from(v).toString("utf-8") : v
|
|
@@ -46,10 +119,32 @@ var Fs = class extends MimeService {
|
|
|
46
119
|
return true;
|
|
47
120
|
} else return false;
|
|
48
121
|
}
|
|
49
|
-
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param path path to the directory relative to the cwd
|
|
125
|
+
* @param options options for reading the directory, defaults to recursive
|
|
126
|
+
*
|
|
127
|
+
* The following two examples are equivalent:
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const fs = new Fs(process.cwd());
|
|
132
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
133
|
+
* console.log(files);
|
|
134
|
+
* ```
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const fs = new Fs(process.cwd());
|
|
138
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
139
|
+
* console.log(files);
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @returns an array of strings representing the contents of the directory
|
|
143
|
+
*/
|
|
144
|
+
readDir(path, options = { recursive: true }) {
|
|
50
145
|
if (this.isRootPathTargeted(path)) {
|
|
51
146
|
return this.handleBuffStrArrUnion(
|
|
52
|
-
fsSync.readdirSync(resolve(join(this.cwd, "./")), options)
|
|
147
|
+
fsSync.readdirSync(resolve(join(this.cwd, "./")), { ...options })
|
|
53
148
|
);
|
|
54
149
|
} else {
|
|
55
150
|
return this.handleBuffStrArrUnion(
|
|
@@ -67,9 +162,7 @@ var Fs = class extends MimeService {
|
|
|
67
162
|
"utf-8"
|
|
68
163
|
), "executeCommand");
|
|
69
164
|
existsSync(path) {
|
|
70
|
-
|
|
71
|
-
return fsSync.existsSync(resolve(join(this.cwd, path)));
|
|
72
|
-
return fsSync.existsSync(relative(this.cwd, path));
|
|
165
|
+
return this.exists(path);
|
|
73
166
|
}
|
|
74
167
|
pathHandler(path) {
|
|
75
168
|
return /\//g.test(path) === true ? path.split(/([/])/gim).reverse().slice(2).reverse().join("") : path;
|
|
@@ -77,12 +170,56 @@ var Fs = class extends MimeService {
|
|
|
77
170
|
mkdirSync(path, options) {
|
|
78
171
|
return fsSync.mkdirSync(relative(this.cwd, path), options);
|
|
79
172
|
}
|
|
173
|
+
units = unitsObj;
|
|
174
|
+
u = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
175
|
+
autoFileSizeRaw(size) {
|
|
176
|
+
let s = typeof size === "bigint" ? Number(size) : size;
|
|
177
|
+
let i = 0;
|
|
178
|
+
while (s >= 1024 && i < this.u.length - 1) {
|
|
179
|
+
s /= 1024;
|
|
180
|
+
i++;
|
|
181
|
+
}
|
|
182
|
+
return { value: s, unit: this.u[i] };
|
|
183
|
+
}
|
|
184
|
+
getSize(size, target, opts = { decimals: 4, includeUnits: true }) {
|
|
185
|
+
const { decimals, includeUnits } = opts;
|
|
186
|
+
if (target === "auto") {
|
|
187
|
+
const { value, unit } = this.autoFileSizeRaw(size);
|
|
188
|
+
const rounded2 = value.toFixed(decimals);
|
|
189
|
+
return includeUnits ? `${rounded2} ${unit}` : Number.parseFloat(rounded2);
|
|
190
|
+
}
|
|
191
|
+
const key = target.toUpperCase();
|
|
192
|
+
const exp = this.units[key];
|
|
193
|
+
const divisor = typeof size === "bigint" ? 1024n ** BigInt(exp) : 1024 ** exp;
|
|
194
|
+
let v = 0;
|
|
195
|
+
if (typeof size === "bigint" || typeof divisor === "bigint") {
|
|
196
|
+
if (typeof size === "bigint" && typeof divisor === "bigint")
|
|
197
|
+
v = Number(size / divisor);
|
|
198
|
+
else if (typeof size !== "bigint" && typeof divisor === "bigint")
|
|
199
|
+
v = size / Number(divisor);
|
|
200
|
+
else if (typeof size === "bigint" && typeof divisor !== "bigint")
|
|
201
|
+
v = Number(size) / divisor;
|
|
202
|
+
} else if (typeof size === "number" && typeof divisor === "number") {
|
|
203
|
+
v = size / divisor;
|
|
204
|
+
}
|
|
205
|
+
const rounded = v.toFixed(decimals);
|
|
206
|
+
return includeUnits ? `${rounded} ${key}` : Number.parseFloat(rounded);
|
|
207
|
+
}
|
|
80
208
|
fileSizeMb(path) {
|
|
81
209
|
return fsSync.statSync(relative(this.cwd, path)).size / (1024 * 1024);
|
|
82
210
|
}
|
|
211
|
+
fileSize(path, target, opts) {
|
|
212
|
+
if (!this.exists(path)) throw new Error(`path ${path} does not exist`);
|
|
213
|
+
else {
|
|
214
|
+
return this.getSize(
|
|
215
|
+
fsSync.statSync(relative(this.cwd, path)).size,
|
|
216
|
+
target,
|
|
217
|
+
opts
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
83
221
|
generateDirIfDNE(path, options) {
|
|
84
|
-
|
|
85
|
-
if (doesExist === true) return;
|
|
222
|
+
if (this.existsSync(path)) return;
|
|
86
223
|
else {
|
|
87
224
|
return this.mkdirSync(path, options);
|
|
88
225
|
}
|
|
@@ -128,14 +265,6 @@ var Fs = class extends MimeService {
|
|
|
128
265
|
);
|
|
129
266
|
}
|
|
130
267
|
}, "writeFileAsync");
|
|
131
|
-
dirExists(dir) {
|
|
132
|
-
const resolved = relative(this.cwd, dir);
|
|
133
|
-
try {
|
|
134
|
-
return fsSync.statSync(resolved).isDirectory();
|
|
135
|
-
} catch {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
268
|
async unlink(path) {
|
|
140
269
|
if (this.existsSync(path)) {
|
|
141
270
|
return await fsAsync.unlink(relative(this.cwd, path));
|
|
@@ -144,7 +273,7 @@ var Fs = class extends MimeService {
|
|
|
144
273
|
}
|
|
145
274
|
}
|
|
146
275
|
rmFile(filePath) {
|
|
147
|
-
if (this.
|
|
276
|
+
if (this.exists(filePath)) {
|
|
148
277
|
if (this.isRootPathTargeted(filePath)) {
|
|
149
278
|
fsSync.rmSync(resolve(join(this.cwd, filePath)));
|
|
150
279
|
} else fsSync.rmSync(resolve(this.cwd, filePath));
|
|
@@ -152,7 +281,7 @@ var Fs = class extends MimeService {
|
|
|
152
281
|
}
|
|
153
282
|
async rmdir(dir, options) {
|
|
154
283
|
const resolved = relative(this.cwd, dir);
|
|
155
|
-
if (this.
|
|
284
|
+
if (this.exists(dir)) {
|
|
156
285
|
return fsAsync.rmdir(relative(this.cwd, dir), options);
|
|
157
286
|
} else {
|
|
158
287
|
throw new Error(`directory ${resolved} does not exist`);
|
|
@@ -160,7 +289,7 @@ var Fs = class extends MimeService {
|
|
|
160
289
|
}
|
|
161
290
|
rmDirSync(dir) {
|
|
162
291
|
const resolved = resolve(this.cwd, dir);
|
|
163
|
-
if (this.
|
|
292
|
+
if (this.exists(dir)) {
|
|
164
293
|
return fsSync.rm(resolved, { force: true, recursive: true }, (err) => {
|
|
165
294
|
if (err?.message) {
|
|
166
295
|
console.error(err?.message);
|
|
@@ -325,4 +454,4 @@ var Fs = class extends MimeService {
|
|
|
325
454
|
export {
|
|
326
455
|
Fs
|
|
327
456
|
};
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
457
|
+
//# sourceMappingURL=chunk-73BXX52B.js.map
|
package/dist/fs/index.cjs
CHANGED
|
@@ -213,6 +213,16 @@ var MimeService = class extends UrlService {
|
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
+
// src/types/index.ts
|
|
217
|
+
var unitsObj = {
|
|
218
|
+
PB: 5,
|
|
219
|
+
TB: 4,
|
|
220
|
+
GB: 3,
|
|
221
|
+
MB: 2,
|
|
222
|
+
KB: 1,
|
|
223
|
+
B: 0
|
|
224
|
+
};
|
|
225
|
+
|
|
216
226
|
// src/fs/index.ts
|
|
217
227
|
dotenv.config();
|
|
218
228
|
var Fs = class extends MimeService {
|
|
@@ -229,14 +239,84 @@ var Fs = class extends MimeService {
|
|
|
229
239
|
parseDotEnv() {
|
|
230
240
|
return import_dotenv_expand.default.expand(this.myEnv);
|
|
231
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
*
|
|
244
|
+
* @param target path to the file or directory to check for existence
|
|
245
|
+
* @returns true if the file or directory exists, false otherwise
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const fs = new Fs(process.cwd());
|
|
249
|
+
* const exists = fs.exists("my-file.txt");
|
|
250
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
251
|
+
* ```
|
|
252
|
+
* @description
|
|
253
|
+
* This method checks if a file or directory exists at the specified path input
|
|
254
|
+
*
|
|
255
|
+
* Additional Note:
|
|
256
|
+
*
|
|
257
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
258
|
+
*
|
|
259
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
232
262
|
exists(target) {
|
|
233
|
-
if (!/\//gm.test(target))
|
|
234
|
-
|
|
235
|
-
|
|
263
|
+
if (!/\//gm.test(target)) {
|
|
264
|
+
if (/\./g.test(target)) {
|
|
265
|
+
return import_fs.default.existsSync((0, import_path.resolve)((0, import_path.join)(this.cwd, target)));
|
|
266
|
+
} else {
|
|
267
|
+
const statsSync = import_fs.default.statSync((0, import_path.resolve)((0, import_path.join)(this.cwd, target)), {
|
|
268
|
+
throwIfNoEntry: false
|
|
269
|
+
});
|
|
270
|
+
const isDir = statsSync?.isDirectory();
|
|
271
|
+
if (isDir) {
|
|
272
|
+
return isDir;
|
|
273
|
+
} else return false;
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
if (/\./g.test(target)) {
|
|
277
|
+
return import_fs.default.existsSync((0, import_path.relative)(this.cwd ?? process.cwd(), target));
|
|
278
|
+
} else {
|
|
279
|
+
const statsSync = import_fs.default.statSync((0, import_path.relative)(this.cwd, target), {
|
|
280
|
+
throwIfNoEntry: false
|
|
281
|
+
});
|
|
282
|
+
const isDir = statsSync?.isDirectory();
|
|
283
|
+
if (isDir) {
|
|
284
|
+
return isDir;
|
|
285
|
+
} else return false;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
236
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* @param ms milliseconds to wait
|
|
292
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* const fs = new Fs(process.cwd());
|
|
296
|
+
* await fs.wait(1000); // waits for 1 second
|
|
297
|
+
* console.log("Done waiting!");
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* Alternatively, you can use it like this:
|
|
301
|
+
* ```ts
|
|
302
|
+
* const fs = new Fs(process.cwd());
|
|
303
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
304
|
+
* console.log("Done waiting!");
|
|
305
|
+
* // do something after waiting
|
|
306
|
+
* });
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @description
|
|
310
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
311
|
+
*/
|
|
237
312
|
wait(ms) {
|
|
238
313
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
239
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
317
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
318
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
319
|
+
*/
|
|
240
320
|
handleBuffStrArrUnion(arr) {
|
|
241
321
|
return arr.map(
|
|
242
322
|
(v) => Buffer.isBuffer(v) ? Buffer.from(v).toString("utf-8") : v
|
|
@@ -247,10 +327,32 @@ var Fs = class extends MimeService {
|
|
|
247
327
|
return true;
|
|
248
328
|
} else return false;
|
|
249
329
|
}
|
|
250
|
-
|
|
330
|
+
/**
|
|
331
|
+
*
|
|
332
|
+
* @param path path to the directory relative to the cwd
|
|
333
|
+
* @param options options for reading the directory, defaults to recursive
|
|
334
|
+
*
|
|
335
|
+
* The following two examples are equivalent:
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* const fs = new Fs(process.cwd());
|
|
340
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
341
|
+
* console.log(files);
|
|
342
|
+
* ```
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* const fs = new Fs(process.cwd());
|
|
346
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
347
|
+
* console.log(files);
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* @returns an array of strings representing the contents of the directory
|
|
351
|
+
*/
|
|
352
|
+
readDir(path, options = { recursive: true }) {
|
|
251
353
|
if (this.isRootPathTargeted(path)) {
|
|
252
354
|
return this.handleBuffStrArrUnion(
|
|
253
|
-
import_fs.default.readdirSync((0, import_path.resolve)((0, import_path.join)(this.cwd, "./")), options)
|
|
355
|
+
import_fs.default.readdirSync((0, import_path.resolve)((0, import_path.join)(this.cwd, "./")), { ...options })
|
|
254
356
|
);
|
|
255
357
|
} else {
|
|
256
358
|
return this.handleBuffStrArrUnion(
|
|
@@ -268,9 +370,7 @@ var Fs = class extends MimeService {
|
|
|
268
370
|
"utf-8"
|
|
269
371
|
), "executeCommand");
|
|
270
372
|
existsSync(path) {
|
|
271
|
-
|
|
272
|
-
return import_fs.default.existsSync((0, import_path.resolve)((0, import_path.join)(this.cwd, path)));
|
|
273
|
-
return import_fs.default.existsSync((0, import_path.relative)(this.cwd, path));
|
|
373
|
+
return this.exists(path);
|
|
274
374
|
}
|
|
275
375
|
pathHandler(path) {
|
|
276
376
|
return /\//g.test(path) === true ? path.split(/([/])/gim).reverse().slice(2).reverse().join("") : path;
|
|
@@ -278,12 +378,56 @@ var Fs = class extends MimeService {
|
|
|
278
378
|
mkdirSync(path, options) {
|
|
279
379
|
return import_fs.default.mkdirSync((0, import_path.relative)(this.cwd, path), options);
|
|
280
380
|
}
|
|
381
|
+
units = unitsObj;
|
|
382
|
+
u = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
383
|
+
autoFileSizeRaw(size) {
|
|
384
|
+
let s = typeof size === "bigint" ? Number(size) : size;
|
|
385
|
+
let i = 0;
|
|
386
|
+
while (s >= 1024 && i < this.u.length - 1) {
|
|
387
|
+
s /= 1024;
|
|
388
|
+
i++;
|
|
389
|
+
}
|
|
390
|
+
return { value: s, unit: this.u[i] };
|
|
391
|
+
}
|
|
392
|
+
getSize(size, target, opts = { decimals: 4, includeUnits: true }) {
|
|
393
|
+
const { decimals, includeUnits } = opts;
|
|
394
|
+
if (target === "auto") {
|
|
395
|
+
const { value, unit } = this.autoFileSizeRaw(size);
|
|
396
|
+
const rounded2 = value.toFixed(decimals);
|
|
397
|
+
return includeUnits ? `${rounded2} ${unit}` : Number.parseFloat(rounded2);
|
|
398
|
+
}
|
|
399
|
+
const key = target.toUpperCase();
|
|
400
|
+
const exp = this.units[key];
|
|
401
|
+
const divisor = typeof size === "bigint" ? 1024n ** BigInt(exp) : 1024 ** exp;
|
|
402
|
+
let v = 0;
|
|
403
|
+
if (typeof size === "bigint" || typeof divisor === "bigint") {
|
|
404
|
+
if (typeof size === "bigint" && typeof divisor === "bigint")
|
|
405
|
+
v = Number(size / divisor);
|
|
406
|
+
else if (typeof size !== "bigint" && typeof divisor === "bigint")
|
|
407
|
+
v = size / Number(divisor);
|
|
408
|
+
else if (typeof size === "bigint" && typeof divisor !== "bigint")
|
|
409
|
+
v = Number(size) / divisor;
|
|
410
|
+
} else if (typeof size === "number" && typeof divisor === "number") {
|
|
411
|
+
v = size / divisor;
|
|
412
|
+
}
|
|
413
|
+
const rounded = v.toFixed(decimals);
|
|
414
|
+
return includeUnits ? `${rounded} ${key}` : Number.parseFloat(rounded);
|
|
415
|
+
}
|
|
281
416
|
fileSizeMb(path) {
|
|
282
417
|
return import_fs.default.statSync((0, import_path.relative)(this.cwd, path)).size / (1024 * 1024);
|
|
283
418
|
}
|
|
419
|
+
fileSize(path, target, opts) {
|
|
420
|
+
if (!this.exists(path)) throw new Error(`path ${path} does not exist`);
|
|
421
|
+
else {
|
|
422
|
+
return this.getSize(
|
|
423
|
+
import_fs.default.statSync((0, import_path.relative)(this.cwd, path)).size,
|
|
424
|
+
target,
|
|
425
|
+
opts
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
284
429
|
generateDirIfDNE(path, options) {
|
|
285
|
-
|
|
286
|
-
if (doesExist === true) return;
|
|
430
|
+
if (this.existsSync(path)) return;
|
|
287
431
|
else {
|
|
288
432
|
return this.mkdirSync(path, options);
|
|
289
433
|
}
|
|
@@ -329,14 +473,6 @@ var Fs = class extends MimeService {
|
|
|
329
473
|
);
|
|
330
474
|
}
|
|
331
475
|
}, "writeFileAsync");
|
|
332
|
-
dirExists(dir) {
|
|
333
|
-
const resolved = (0, import_path.relative)(this.cwd, dir);
|
|
334
|
-
try {
|
|
335
|
-
return import_fs.default.statSync(resolved).isDirectory();
|
|
336
|
-
} catch {
|
|
337
|
-
return false;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
476
|
async unlink(path) {
|
|
341
477
|
if (this.existsSync(path)) {
|
|
342
478
|
return await import_promises.default.unlink((0, import_path.relative)(this.cwd, path));
|
|
@@ -345,7 +481,7 @@ var Fs = class extends MimeService {
|
|
|
345
481
|
}
|
|
346
482
|
}
|
|
347
483
|
rmFile(filePath) {
|
|
348
|
-
if (this.
|
|
484
|
+
if (this.exists(filePath)) {
|
|
349
485
|
if (this.isRootPathTargeted(filePath)) {
|
|
350
486
|
import_fs.default.rmSync((0, import_path.resolve)((0, import_path.join)(this.cwd, filePath)));
|
|
351
487
|
} else import_fs.default.rmSync((0, import_path.resolve)(this.cwd, filePath));
|
|
@@ -353,7 +489,7 @@ var Fs = class extends MimeService {
|
|
|
353
489
|
}
|
|
354
490
|
async rmdir(dir, options) {
|
|
355
491
|
const resolved = (0, import_path.relative)(this.cwd, dir);
|
|
356
|
-
if (this.
|
|
492
|
+
if (this.exists(dir)) {
|
|
357
493
|
return import_promises.default.rmdir((0, import_path.relative)(this.cwd, dir), options);
|
|
358
494
|
} else {
|
|
359
495
|
throw new Error(`directory ${resolved} does not exist`);
|
|
@@ -361,7 +497,7 @@ var Fs = class extends MimeService {
|
|
|
361
497
|
}
|
|
362
498
|
rmDirSync(dir) {
|
|
363
499
|
const resolved = (0, import_path.resolve)(this.cwd, dir);
|
|
364
|
-
if (this.
|
|
500
|
+
if (this.exists(dir)) {
|
|
365
501
|
return import_fs.default.rm(resolved, { force: true, recursive: true }, (err) => {
|
|
366
502
|
if (err?.message) {
|
|
367
503
|
console.error(err?.message);
|
package/dist/fs/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import expand from 'dotenv-expand';
|
|
2
2
|
import sharp from 'sharp';
|
|
3
|
-
import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.cjs';
|
|
3
|
+
import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, Unit, SizeOpts, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.cjs';
|
|
4
4
|
import { MimeService } from '../mime/index.cjs';
|
|
5
5
|
import 'stream';
|
|
6
6
|
import 'buffer';
|
|
@@ -11,20 +11,97 @@ declare class Fs extends MimeService {
|
|
|
11
11
|
constructor(cwd: string);
|
|
12
12
|
private get myEnv();
|
|
13
13
|
parseDotEnv(): expand.DotenvExpandOutput;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param target path to the file or directory to check for existence
|
|
17
|
+
* @returns true if the file or directory exists, false otherwise
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const fs = new Fs(process.cwd());
|
|
21
|
+
* const exists = fs.exists("my-file.txt");
|
|
22
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
23
|
+
* ```
|
|
24
|
+
* @description
|
|
25
|
+
* This method checks if a file or directory exists at the specified path input
|
|
26
|
+
*
|
|
27
|
+
* Additional Note:
|
|
28
|
+
*
|
|
29
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
30
|
+
*
|
|
31
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
14
34
|
exists<const T extends string>(target: T): boolean;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param ms milliseconds to wait
|
|
38
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const fs = new Fs(process.cwd());
|
|
42
|
+
* await fs.wait(1000); // waits for 1 second
|
|
43
|
+
* console.log("Done waiting!");
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Alternatively, you can use it like this:
|
|
47
|
+
* ```ts
|
|
48
|
+
* const fs = new Fs(process.cwd());
|
|
49
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
50
|
+
* console.log("Done waiting!");
|
|
51
|
+
* // do something after waiting
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @description
|
|
56
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
57
|
+
*/
|
|
15
58
|
wait<T extends number>(ms: T): Promise<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
61
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
62
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
63
|
+
*/
|
|
16
64
|
handleBuffStrArrUnion<const T extends (string | Buffer)[] | readonly (string | Buffer)[]>(arr: T): string[];
|
|
17
65
|
isRootPathTargeted<const T extends string>(path: T): boolean;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param path path to the directory relative to the cwd
|
|
69
|
+
* @param options options for reading the directory, defaults to recursive
|
|
70
|
+
*
|
|
71
|
+
* The following two examples are equivalent:
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const fs = new Fs(process.cwd());
|
|
76
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
77
|
+
* console.log(files);
|
|
78
|
+
* ```
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const fs = new Fs(process.cwd());
|
|
82
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
83
|
+
* console.log(files);
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @returns an array of strings representing the contents of the directory
|
|
87
|
+
*/
|
|
18
88
|
readDir<const T extends string>(path: T, options?: ReadDirOptions): string[];
|
|
19
89
|
executeCommand: <const T extends string>({ command, ...options }: ExecuteCommandProps<T>) => string;
|
|
20
90
|
existsSync<const T extends string>(path: T): boolean;
|
|
21
91
|
pathHandler<const T extends string>(path: T): string;
|
|
22
92
|
mkdirSync<const T extends string>(path: T, options?: MkDirSyncOptions): string | undefined;
|
|
93
|
+
private units;
|
|
94
|
+
private u;
|
|
95
|
+
autoFileSizeRaw(size: number | bigint): {
|
|
96
|
+
value: number;
|
|
97
|
+
unit: "B" | "KB" | "MB" | "GB" | "TB" | "PB" | undefined;
|
|
98
|
+
};
|
|
99
|
+
getSize<const S extends Unit | Lowercase<Unit> | "auto">(size: number | bigint, target: S, opts?: SizeOpts): string | number;
|
|
23
100
|
fileSizeMb<const T extends string>(path: T): number;
|
|
101
|
+
fileSize<const T extends string, const S extends Unit | Lowercase<Unit> | "auto">(path: T, target: S, opts?: SizeOpts): string | number;
|
|
24
102
|
generateDirIfDNE<const T extends string>(path: T, options?: MkDirSyncOptions): string | undefined;
|
|
25
103
|
withWs<const T extends string>(path: T, data: WriteStreamDataShape, options?: WriteStreamOptions): string | boolean | undefined;
|
|
26
104
|
writeFileAsync: <const T extends string>(path: T, data: WriteFileAsyncDataUnion, options?: WriteFileAsyncOptions) => Promise<string | void>;
|
|
27
|
-
dirExists<const T extends string>(dir: T): boolean;
|
|
28
105
|
unlink<const P extends string>(path: P): Promise<void>;
|
|
29
106
|
rmFile<const FP extends string>(filePath: FP): void;
|
|
30
107
|
rmdir<const D extends string>(dir: D, options?: RmDirOptions): Promise<void>;
|
package/dist/fs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import expand from 'dotenv-expand';
|
|
2
2
|
import sharp from 'sharp';
|
|
3
|
-
import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.js';
|
|
3
|
+
import { ReadDirOptions, ExecuteCommandProps, MkDirSyncOptions, Unit, SizeOpts, WriteStreamDataShape, WriteStreamOptions, WriteFileAsyncDataUnion, WriteFileAsyncOptions, RmDirOptions } from '../types/index.js';
|
|
4
4
|
import { MimeService } from '../mime/index.js';
|
|
5
5
|
import 'stream';
|
|
6
6
|
import 'buffer';
|
|
@@ -11,20 +11,97 @@ declare class Fs extends MimeService {
|
|
|
11
11
|
constructor(cwd: string);
|
|
12
12
|
private get myEnv();
|
|
13
13
|
parseDotEnv(): expand.DotenvExpandOutput;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param target path to the file or directory to check for existence
|
|
17
|
+
* @returns true if the file or directory exists, false otherwise
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const fs = new Fs(process.cwd());
|
|
21
|
+
* const exists = fs.exists("my-file.txt");
|
|
22
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
23
|
+
* ```
|
|
24
|
+
* @description
|
|
25
|
+
* This method checks if a file or directory exists at the specified path input
|
|
26
|
+
*
|
|
27
|
+
* Additional Note:
|
|
28
|
+
*
|
|
29
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
30
|
+
*
|
|
31
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
14
34
|
exists<const T extends string>(target: T): boolean;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param ms milliseconds to wait
|
|
38
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const fs = new Fs(process.cwd());
|
|
42
|
+
* await fs.wait(1000); // waits for 1 second
|
|
43
|
+
* console.log("Done waiting!");
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Alternatively, you can use it like this:
|
|
47
|
+
* ```ts
|
|
48
|
+
* const fs = new Fs(process.cwd());
|
|
49
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
50
|
+
* console.log("Done waiting!");
|
|
51
|
+
* // do something after waiting
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @description
|
|
56
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
57
|
+
*/
|
|
15
58
|
wait<T extends number>(ms: T): Promise<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
61
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
62
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
63
|
+
*/
|
|
16
64
|
handleBuffStrArrUnion<const T extends (string | Buffer)[] | readonly (string | Buffer)[]>(arr: T): string[];
|
|
17
65
|
isRootPathTargeted<const T extends string>(path: T): boolean;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param path path to the directory relative to the cwd
|
|
69
|
+
* @param options options for reading the directory, defaults to recursive
|
|
70
|
+
*
|
|
71
|
+
* The following two examples are equivalent:
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const fs = new Fs(process.cwd());
|
|
76
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
77
|
+
* console.log(files);
|
|
78
|
+
* ```
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const fs = new Fs(process.cwd());
|
|
82
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
83
|
+
* console.log(files);
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @returns an array of strings representing the contents of the directory
|
|
87
|
+
*/
|
|
18
88
|
readDir<const T extends string>(path: T, options?: ReadDirOptions): string[];
|
|
19
89
|
executeCommand: <const T extends string>({ command, ...options }: ExecuteCommandProps<T>) => string;
|
|
20
90
|
existsSync<const T extends string>(path: T): boolean;
|
|
21
91
|
pathHandler<const T extends string>(path: T): string;
|
|
22
92
|
mkdirSync<const T extends string>(path: T, options?: MkDirSyncOptions): string | undefined;
|
|
93
|
+
private units;
|
|
94
|
+
private u;
|
|
95
|
+
autoFileSizeRaw(size: number | bigint): {
|
|
96
|
+
value: number;
|
|
97
|
+
unit: "B" | "KB" | "MB" | "GB" | "TB" | "PB" | undefined;
|
|
98
|
+
};
|
|
99
|
+
getSize<const S extends Unit | Lowercase<Unit> | "auto">(size: number | bigint, target: S, opts?: SizeOpts): string | number;
|
|
23
100
|
fileSizeMb<const T extends string>(path: T): number;
|
|
101
|
+
fileSize<const T extends string, const S extends Unit | Lowercase<Unit> | "auto">(path: T, target: S, opts?: SizeOpts): string | number;
|
|
24
102
|
generateDirIfDNE<const T extends string>(path: T, options?: MkDirSyncOptions): string | undefined;
|
|
25
103
|
withWs<const T extends string>(path: T, data: WriteStreamDataShape, options?: WriteStreamOptions): string | boolean | undefined;
|
|
26
104
|
writeFileAsync: <const T extends string>(path: T, data: WriteFileAsyncDataUnion, options?: WriteFileAsyncOptions) => Promise<string | void>;
|
|
27
|
-
dirExists<const T extends string>(dir: T): boolean;
|
|
28
105
|
unlink<const P extends string>(path: P): Promise<void>;
|
|
29
106
|
rmFile<const FP extends string>(filePath: FP): void;
|
|
30
107
|
rmdir<const D extends string>(dir: D, options?: RmDirOptions): Promise<void>;
|
package/dist/fs/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
MimeService: () => MimeService,
|
|
36
36
|
UrlService: () => UrlService,
|
|
37
37
|
UtilsService: () => UtilsService,
|
|
38
|
-
extMimeMap: () => extMimeMap
|
|
38
|
+
extMimeMap: () => extMimeMap,
|
|
39
|
+
unitsObj: () => unitsObj
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(index_exports);
|
|
41
42
|
|
|
@@ -219,6 +220,16 @@ var MimeService = class extends UrlService {
|
|
|
219
220
|
}
|
|
220
221
|
};
|
|
221
222
|
|
|
223
|
+
// src/types/index.ts
|
|
224
|
+
var unitsObj = {
|
|
225
|
+
PB: 5,
|
|
226
|
+
TB: 4,
|
|
227
|
+
GB: 3,
|
|
228
|
+
MB: 2,
|
|
229
|
+
KB: 1,
|
|
230
|
+
B: 0
|
|
231
|
+
};
|
|
232
|
+
|
|
222
233
|
// src/fs/index.ts
|
|
223
234
|
dotenv.config();
|
|
224
235
|
var Fs = class extends MimeService {
|
|
@@ -235,14 +246,84 @@ var Fs = class extends MimeService {
|
|
|
235
246
|
parseDotEnv() {
|
|
236
247
|
return import_dotenv_expand.default.expand(this.myEnv);
|
|
237
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
* @param target path to the file or directory to check for existence
|
|
252
|
+
* @returns true if the file or directory exists, false otherwise
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const fs = new Fs(process.cwd());
|
|
256
|
+
* const exists = fs.exists("my-file.txt");
|
|
257
|
+
* console.log(exists); // true if the file exists, false otherwise
|
|
258
|
+
* ```
|
|
259
|
+
* @description
|
|
260
|
+
* This method checks if a file or directory exists at the specified path input
|
|
261
|
+
*
|
|
262
|
+
* Additional Note:
|
|
263
|
+
*
|
|
264
|
+
* say you have a directory that begins with a dot, such as `.turbo`;
|
|
265
|
+
*
|
|
266
|
+
* in this scenario, both `./.turbo` and `.turbo` will return true if the directory exists
|
|
267
|
+
*
|
|
268
|
+
*/
|
|
238
269
|
exists(target) {
|
|
239
|
-
if (!/\//gm.test(target))
|
|
240
|
-
|
|
241
|
-
|
|
270
|
+
if (!/\//gm.test(target)) {
|
|
271
|
+
if (/\./g.test(target)) {
|
|
272
|
+
return import_fs.default.existsSync((0, import_path.resolve)((0, import_path.join)(this.cwd, target)));
|
|
273
|
+
} else {
|
|
274
|
+
const statsSync = import_fs.default.statSync((0, import_path.resolve)((0, import_path.join)(this.cwd, target)), {
|
|
275
|
+
throwIfNoEntry: false
|
|
276
|
+
});
|
|
277
|
+
const isDir = statsSync?.isDirectory();
|
|
278
|
+
if (isDir) {
|
|
279
|
+
return isDir;
|
|
280
|
+
} else return false;
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
if (/\./g.test(target)) {
|
|
284
|
+
return import_fs.default.existsSync((0, import_path.relative)(this.cwd ?? process.cwd(), target));
|
|
285
|
+
} else {
|
|
286
|
+
const statsSync = import_fs.default.statSync((0, import_path.relative)(this.cwd, target), {
|
|
287
|
+
throwIfNoEntry: false
|
|
288
|
+
});
|
|
289
|
+
const isDir = statsSync?.isDirectory();
|
|
290
|
+
if (isDir) {
|
|
291
|
+
return isDir;
|
|
292
|
+
} else return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
242
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
*
|
|
298
|
+
* @param ms milliseconds to wait
|
|
299
|
+
* @returns a promise that resolves after the specified number of milliseconds
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* const fs = new Fs(process.cwd());
|
|
303
|
+
* await fs.wait(1000); // waits for 1 second
|
|
304
|
+
* console.log("Done waiting!");
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* Alternatively, you can use it like this:
|
|
308
|
+
* ```ts
|
|
309
|
+
* const fs = new Fs(process.cwd());
|
|
310
|
+
* fs.wait(1000).then(() => { // waits for 1 second
|
|
311
|
+
* console.log("Done waiting!");
|
|
312
|
+
* // do something after waiting
|
|
313
|
+
* });
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @description
|
|
317
|
+
* This method is useful for delaying execution in asynchronous code, such as when you need to wait for a file operation to complete or when you want to introduce a delay in a loop.
|
|
318
|
+
*/
|
|
243
319
|
wait(ms) {
|
|
244
320
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
245
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Handles an array or readonly array of strings and/or Buffers, converting Buffers to strings
|
|
324
|
+
* @param arr An array or readonly array of strings and/or Buffers
|
|
325
|
+
* @returns An array of strings with Buffers converted to UTF-8 strings.
|
|
326
|
+
*/
|
|
246
327
|
handleBuffStrArrUnion(arr) {
|
|
247
328
|
return arr.map(
|
|
248
329
|
(v) => Buffer.isBuffer(v) ? Buffer.from(v).toString("utf-8") : v
|
|
@@ -253,10 +334,32 @@ var Fs = class extends MimeService {
|
|
|
253
334
|
return true;
|
|
254
335
|
} else return false;
|
|
255
336
|
}
|
|
256
|
-
|
|
337
|
+
/**
|
|
338
|
+
*
|
|
339
|
+
* @param path path to the directory relative to the cwd
|
|
340
|
+
* @param options options for reading the directory, defaults to recursive
|
|
341
|
+
*
|
|
342
|
+
* The following two examples are equivalent:
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* const fs = new Fs(process.cwd());
|
|
347
|
+
* const files = fs.readDir("./my-directory", { recursive: true });
|
|
348
|
+
* console.log(files);
|
|
349
|
+
* ```
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* const fs = new Fs(process.cwd());
|
|
353
|
+
* const files = fs.readDir("my-directory", { recursive: true });
|
|
354
|
+
* console.log(files);
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* @returns an array of strings representing the contents of the directory
|
|
358
|
+
*/
|
|
359
|
+
readDir(path, options = { recursive: true }) {
|
|
257
360
|
if (this.isRootPathTargeted(path)) {
|
|
258
361
|
return this.handleBuffStrArrUnion(
|
|
259
|
-
import_fs.default.readdirSync((0, import_path.resolve)((0, import_path.join)(this.cwd, "./")), options)
|
|
362
|
+
import_fs.default.readdirSync((0, import_path.resolve)((0, import_path.join)(this.cwd, "./")), { ...options })
|
|
260
363
|
);
|
|
261
364
|
} else {
|
|
262
365
|
return this.handleBuffStrArrUnion(
|
|
@@ -274,9 +377,7 @@ var Fs = class extends MimeService {
|
|
|
274
377
|
"utf-8"
|
|
275
378
|
), "executeCommand");
|
|
276
379
|
existsSync(path) {
|
|
277
|
-
|
|
278
|
-
return import_fs.default.existsSync((0, import_path.resolve)((0, import_path.join)(this.cwd, path)));
|
|
279
|
-
return import_fs.default.existsSync((0, import_path.relative)(this.cwd, path));
|
|
380
|
+
return this.exists(path);
|
|
280
381
|
}
|
|
281
382
|
pathHandler(path) {
|
|
282
383
|
return /\//g.test(path) === true ? path.split(/([/])/gim).reverse().slice(2).reverse().join("") : path;
|
|
@@ -284,12 +385,56 @@ var Fs = class extends MimeService {
|
|
|
284
385
|
mkdirSync(path, options) {
|
|
285
386
|
return import_fs.default.mkdirSync((0, import_path.relative)(this.cwd, path), options);
|
|
286
387
|
}
|
|
388
|
+
units = unitsObj;
|
|
389
|
+
u = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
390
|
+
autoFileSizeRaw(size) {
|
|
391
|
+
let s = typeof size === "bigint" ? Number(size) : size;
|
|
392
|
+
let i = 0;
|
|
393
|
+
while (s >= 1024 && i < this.u.length - 1) {
|
|
394
|
+
s /= 1024;
|
|
395
|
+
i++;
|
|
396
|
+
}
|
|
397
|
+
return { value: s, unit: this.u[i] };
|
|
398
|
+
}
|
|
399
|
+
getSize(size, target, opts = { decimals: 4, includeUnits: true }) {
|
|
400
|
+
const { decimals, includeUnits } = opts;
|
|
401
|
+
if (target === "auto") {
|
|
402
|
+
const { value, unit } = this.autoFileSizeRaw(size);
|
|
403
|
+
const rounded2 = value.toFixed(decimals);
|
|
404
|
+
return includeUnits ? `${rounded2} ${unit}` : Number.parseFloat(rounded2);
|
|
405
|
+
}
|
|
406
|
+
const key = target.toUpperCase();
|
|
407
|
+
const exp = this.units[key];
|
|
408
|
+
const divisor = typeof size === "bigint" ? 1024n ** BigInt(exp) : 1024 ** exp;
|
|
409
|
+
let v = 0;
|
|
410
|
+
if (typeof size === "bigint" || typeof divisor === "bigint") {
|
|
411
|
+
if (typeof size === "bigint" && typeof divisor === "bigint")
|
|
412
|
+
v = Number(size / divisor);
|
|
413
|
+
else if (typeof size !== "bigint" && typeof divisor === "bigint")
|
|
414
|
+
v = size / Number(divisor);
|
|
415
|
+
else if (typeof size === "bigint" && typeof divisor !== "bigint")
|
|
416
|
+
v = Number(size) / divisor;
|
|
417
|
+
} else if (typeof size === "number" && typeof divisor === "number") {
|
|
418
|
+
v = size / divisor;
|
|
419
|
+
}
|
|
420
|
+
const rounded = v.toFixed(decimals);
|
|
421
|
+
return includeUnits ? `${rounded} ${key}` : Number.parseFloat(rounded);
|
|
422
|
+
}
|
|
287
423
|
fileSizeMb(path) {
|
|
288
424
|
return import_fs.default.statSync((0, import_path.relative)(this.cwd, path)).size / (1024 * 1024);
|
|
289
425
|
}
|
|
426
|
+
fileSize(path, target, opts) {
|
|
427
|
+
if (!this.exists(path)) throw new Error(`path ${path} does not exist`);
|
|
428
|
+
else {
|
|
429
|
+
return this.getSize(
|
|
430
|
+
import_fs.default.statSync((0, import_path.relative)(this.cwd, path)).size,
|
|
431
|
+
target,
|
|
432
|
+
opts
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
290
436
|
generateDirIfDNE(path, options) {
|
|
291
|
-
|
|
292
|
-
if (doesExist === true) return;
|
|
437
|
+
if (this.existsSync(path)) return;
|
|
293
438
|
else {
|
|
294
439
|
return this.mkdirSync(path, options);
|
|
295
440
|
}
|
|
@@ -335,14 +480,6 @@ var Fs = class extends MimeService {
|
|
|
335
480
|
);
|
|
336
481
|
}
|
|
337
482
|
}, "writeFileAsync");
|
|
338
|
-
dirExists(dir) {
|
|
339
|
-
const resolved = (0, import_path.relative)(this.cwd, dir);
|
|
340
|
-
try {
|
|
341
|
-
return import_fs.default.statSync(resolved).isDirectory();
|
|
342
|
-
} catch {
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
483
|
async unlink(path) {
|
|
347
484
|
if (this.existsSync(path)) {
|
|
348
485
|
return await import_promises.default.unlink((0, import_path.relative)(this.cwd, path));
|
|
@@ -351,7 +488,7 @@ var Fs = class extends MimeService {
|
|
|
351
488
|
}
|
|
352
489
|
}
|
|
353
490
|
rmFile(filePath) {
|
|
354
|
-
if (this.
|
|
491
|
+
if (this.exists(filePath)) {
|
|
355
492
|
if (this.isRootPathTargeted(filePath)) {
|
|
356
493
|
import_fs.default.rmSync((0, import_path.resolve)((0, import_path.join)(this.cwd, filePath)));
|
|
357
494
|
} else import_fs.default.rmSync((0, import_path.resolve)(this.cwd, filePath));
|
|
@@ -359,7 +496,7 @@ var Fs = class extends MimeService {
|
|
|
359
496
|
}
|
|
360
497
|
async rmdir(dir, options) {
|
|
361
498
|
const resolved = (0, import_path.relative)(this.cwd, dir);
|
|
362
|
-
if (this.
|
|
499
|
+
if (this.exists(dir)) {
|
|
363
500
|
return import_promises.default.rmdir((0, import_path.relative)(this.cwd, dir), options);
|
|
364
501
|
} else {
|
|
365
502
|
throw new Error(`directory ${resolved} does not exist`);
|
|
@@ -367,7 +504,7 @@ var Fs = class extends MimeService {
|
|
|
367
504
|
}
|
|
368
505
|
rmDirSync(dir) {
|
|
369
506
|
const resolved = (0, import_path.resolve)(this.cwd, dir);
|
|
370
|
-
if (this.
|
|
507
|
+
if (this.exists(dir)) {
|
|
371
508
|
return import_fs.default.rm(resolved, { force: true, recursive: true }, (err) => {
|
|
372
509
|
if (err?.message) {
|
|
373
510
|
console.error(err?.message);
|
|
@@ -657,6 +794,7 @@ var UtilsService = class {
|
|
|
657
794
|
MimeService,
|
|
658
795
|
UrlService,
|
|
659
796
|
UtilsService,
|
|
660
|
-
extMimeMap
|
|
797
|
+
extMimeMap,
|
|
798
|
+
unitsObj
|
|
661
799
|
});
|
|
662
800
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.cjs';
|
|
2
2
|
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.cjs';
|
|
3
|
-
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, StdioOptions, TypedArray, Unenumerate, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR } from './types/index.cjs';
|
|
3
|
+
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, SizeOpts, StdioOptions, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.cjs';
|
|
4
4
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.cjs';
|
|
5
5
|
export { UtilsService } from './utils/index.cjs';
|
|
6
6
|
import 'dotenv-expand';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Fs } from './fs/index.js';
|
|
2
2
|
export { AllMimeTypes, FileExtension, FileExtensionToMimeType, InferTopLevelPresent, MimeService, MimeTopLevelType, PresentMimeTopLevelTypes, extMimeMap } from './mime/index.js';
|
|
3
|
-
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, StdioOptions, TypedArray, Unenumerate, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR } from './types/index.js';
|
|
3
|
+
export { Abortable, ArrayBufferView, ArrayOrReadOnlyArray, BashEnv, BufferEncodingUnion, CoercionUnion, CommonExecOptions, CommonOptions, ConditionalPromise, ConditionalToRequired, Depth, Dict, Equal, ExcludeFieldEnumerable, ExecSyncOptions, ExecSyncOptionsWithBufferEncoding, ExecSyncOptionsWithStringEncoding, ExecuteCommandProps, Expect, Extends, FieldToConditionallyNever, IOType, InferDepth, InjectScriptsProps, MkDirOptions, MkDirSyncOptions, MkDirSyncProps, Mode, ObjEncodingOptions, OmitSrc, OpenMode, ParsedUrlInfo, ProcessEnv, ProcessEnvOptions, ReadDirOptions, ReadDirProps, RemoveFields, RequiredToConditional, RmDirOptions, RmDirProps, Signals, SizeOpts, StdioOptions, TypedArray, Unenumerate, Unit, UnwrapPromise, Without, WriteFileAsyncDataUnion, WriteFileAsyncOptions, WriteFileAsyncProps, WriteStreamDataShape, WriteStreamOptions, WriteStreamProps, XOR, unitsObj } from './types/index.js';
|
|
4
4
|
export { HandleQueryParamsOrHash, InferExtensionIfPresent, LastSegment, SplitForwardSlash, UrlFileExt, UrlService } from './url/index.js';
|
|
5
5
|
export { UtilsService } from './utils/index.js';
|
|
6
6
|
import 'dotenv-expand';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-73BXX52B.js";
|
|
4
4
|
import {
|
|
5
5
|
MimeService,
|
|
6
6
|
extMimeMap
|
|
7
7
|
} from "./chunk-EHOBCDHE.js";
|
|
8
|
+
import {
|
|
9
|
+
unitsObj
|
|
10
|
+
} from "./chunk-4X5DVWVM.js";
|
|
8
11
|
import {
|
|
9
12
|
UrlService
|
|
10
13
|
} from "./chunk-XHN56MDK.js";
|
|
@@ -17,6 +20,7 @@ export {
|
|
|
17
20
|
MimeService,
|
|
18
21
|
UrlService,
|
|
19
22
|
UtilsService,
|
|
20
|
-
extMimeMap
|
|
23
|
+
extMimeMap,
|
|
24
|
+
unitsObj
|
|
21
25
|
};
|
|
22
26
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -15,5 +19,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
15
19
|
|
|
16
20
|
// src/types/index.ts
|
|
17
21
|
var types_exports = {};
|
|
22
|
+
__export(types_exports, {
|
|
23
|
+
unitsObj: () => unitsObj
|
|
24
|
+
});
|
|
18
25
|
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
var unitsObj = {
|
|
27
|
+
PB: 5,
|
|
28
|
+
TB: 4,
|
|
29
|
+
GB: 3,
|
|
30
|
+
MB: 2,
|
|
31
|
+
KB: 1,
|
|
32
|
+
B: 0
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
unitsObj
|
|
37
|
+
});
|
|
19
38
|
//# sourceMappingURL=index.cjs.map
|
package/dist/types/index.d.cts
CHANGED
|
@@ -101,10 +101,13 @@ type WriteStreamOptions = BufferEncodingUnion | {
|
|
|
101
101
|
type WriteFileAsyncDataUnion = WithImplicitCoercion<string> | {
|
|
102
102
|
[Symbol.toPrimitive](hint: "string"): string;
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
interface ReadDirOptionsEntity extends ObjEncodingOptions {
|
|
105
105
|
withFileTypes?: false | undefined;
|
|
106
106
|
recursive?: boolean | undefined;
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
|
+
type ReadDirOptions = {
|
|
109
|
+
[P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P];
|
|
110
|
+
};
|
|
108
111
|
type WriteFileAsyncOptions = (ObjEncodingOptions & {
|
|
109
112
|
mode?: Mode | undefined;
|
|
110
113
|
flag?: OpenMode | undefined;
|
|
@@ -243,5 +246,18 @@ type ParsedUrlInfo = {
|
|
|
243
246
|
search: string;
|
|
244
247
|
hash: string;
|
|
245
248
|
};
|
|
249
|
+
declare const unitsObj: {
|
|
250
|
+
readonly PB: 5;
|
|
251
|
+
readonly TB: 4;
|
|
252
|
+
readonly GB: 3;
|
|
253
|
+
readonly MB: 2;
|
|
254
|
+
readonly KB: 1;
|
|
255
|
+
readonly B: 0;
|
|
256
|
+
};
|
|
257
|
+
type Unit = keyof typeof unitsObj;
|
|
258
|
+
type SizeOpts = {
|
|
259
|
+
decimals?: number;
|
|
260
|
+
includeUnits?: boolean;
|
|
261
|
+
};
|
|
246
262
|
|
|
247
|
-
export type
|
|
263
|
+
export { type Abortable, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BufferEncodingUnion, type CoercionUnion, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, type Depth, type Dict, type Equal, type ExcludeFieldEnumerable, type ExecSyncOptions, type ExecSyncOptionsWithBufferEncoding, type ExecSyncOptionsWithStringEncoding, type ExecuteCommandProps, type Expect, type Extends, type FieldToConditionallyNever, type IOType, type InferDepth, type InjectScriptsProps, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type ObjEncodingOptions, type OmitSrc, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequiredToConditional, type RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataUnion, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamDataShape, type WriteStreamOptions, type WriteStreamProps, type XOR, unitsObj };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -101,10 +101,13 @@ type WriteStreamOptions = BufferEncodingUnion | {
|
|
|
101
101
|
type WriteFileAsyncDataUnion = WithImplicitCoercion<string> | {
|
|
102
102
|
[Symbol.toPrimitive](hint: "string"): string;
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
interface ReadDirOptionsEntity extends ObjEncodingOptions {
|
|
105
105
|
withFileTypes?: false | undefined;
|
|
106
106
|
recursive?: boolean | undefined;
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
|
+
type ReadDirOptions = {
|
|
109
|
+
[P in keyof ReadDirOptionsEntity]: ReadDirOptionsEntity[P];
|
|
110
|
+
};
|
|
108
111
|
type WriteFileAsyncOptions = (ObjEncodingOptions & {
|
|
109
112
|
mode?: Mode | undefined;
|
|
110
113
|
flag?: OpenMode | undefined;
|
|
@@ -243,5 +246,18 @@ type ParsedUrlInfo = {
|
|
|
243
246
|
search: string;
|
|
244
247
|
hash: string;
|
|
245
248
|
};
|
|
249
|
+
declare const unitsObj: {
|
|
250
|
+
readonly PB: 5;
|
|
251
|
+
readonly TB: 4;
|
|
252
|
+
readonly GB: 3;
|
|
253
|
+
readonly MB: 2;
|
|
254
|
+
readonly KB: 1;
|
|
255
|
+
readonly B: 0;
|
|
256
|
+
};
|
|
257
|
+
type Unit = keyof typeof unitsObj;
|
|
258
|
+
type SizeOpts = {
|
|
259
|
+
decimals?: number;
|
|
260
|
+
includeUnits?: boolean;
|
|
261
|
+
};
|
|
246
262
|
|
|
247
|
-
export type
|
|
263
|
+
export { type Abortable, type ArrayBufferView, type ArrayOrReadOnlyArray, type BashEnv, type BufferEncodingUnion, type CoercionUnion, type CommonExecOptions, type CommonOptions, type ConditionalPromise, type ConditionalToRequired, type Depth, type Dict, type Equal, type ExcludeFieldEnumerable, type ExecSyncOptions, type ExecSyncOptionsWithBufferEncoding, type ExecSyncOptionsWithStringEncoding, type ExecuteCommandProps, type Expect, type Extends, type FieldToConditionallyNever, type IOType, type InferDepth, type InjectScriptsProps, type MkDirOptions, type MkDirSyncOptions, type MkDirSyncProps, type Mode, type ObjEncodingOptions, type OmitSrc, type OpenMode, type ParsedUrlInfo, type ProcessEnv, type ProcessEnvOptions, type ReadDirOptions, type ReadDirOptionsEntity, type ReadDirProps, type RemoveFields, type RequiredToConditional, type RmDirOptions, type RmDirProps, type Signals, type SizeOpts, type StdioOptions, type TypedArray, type Unenumerate, type Unit, type UnwrapPromise, type Without, type WriteFileAsyncDataUnion, type WriteFileAsyncOptions, type WriteFileAsyncProps, type WriteStreamDataShape, type WriteStreamOptions, type WriteStreamProps, type XOR, unitsObj };
|
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d0paminedriven/fs",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "convenient fs helpers",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"typescript": "latest",
|
|
69
69
|
"typescript-eslint": "latest",
|
|
70
70
|
"@d0paminedriven/eslint-config": "0.1.0",
|
|
71
|
-
"@d0paminedriven/
|
|
72
|
-
"@d0paminedriven/
|
|
71
|
+
"@d0paminedriven/prettier-config": "0.1.0",
|
|
72
|
+
"@d0paminedriven/tsconfig": "0.1.0"
|
|
73
73
|
},
|
|
74
74
|
"prettier": "@d0paminedriven/prettier-config",
|
|
75
75
|
"scripts": {
|