@catbee/utils 2.0.0-next.0 → 2.0.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.
Files changed (122) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +102 -52
  3. package/array/index.cjs +215 -74
  4. package/array/index.d.ts +345 -2
  5. package/array/index.mjs +201 -74
  6. package/async/index.cjs +116 -39
  7. package/async/index.d.ts +292 -2
  8. package/async/index.mjs +116 -40
  9. package/cache/index.cjs +2 -2
  10. package/cache/index.d.ts +156 -2
  11. package/cache/index.mjs +3 -3
  12. package/config/index.cjs +80 -66
  13. package/config/index.d.ts +65 -3
  14. package/config/index.mjs +77 -65
  15. package/context-store/index.cjs +2 -3
  16. package/context-store/index.d.ts +193 -2
  17. package/context-store/index.mjs +2 -3
  18. package/crypto/index.cjs +55 -5
  19. package/crypto/index.d.ts +225 -2
  20. package/crypto/index.mjs +52 -7
  21. package/date/index.cjs +676 -2
  22. package/date/index.d.ts +676 -2
  23. package/date/index.mjs +665 -3
  24. package/decorator/index.cjs +2172 -0
  25. package/{decorators/decorators.utils.d.ts → decorator/index.d.ts} +58 -54
  26. package/decorator/index.mjs +2131 -0
  27. package/{dir → directory}/index.cjs +5 -4
  28. package/{dir/dir.utils.d.ts → directory/index.d.ts} +24 -21
  29. package/{dir → directory}/index.mjs +5 -4
  30. package/env/index.cjs +100 -68
  31. package/env/index.d.ts +391 -2
  32. package/env/index.mjs +100 -68
  33. package/exception/index.cjs +1 -1
  34. package/exception/index.d.ts +233 -2
  35. package/exception/index.mjs +1 -1
  36. package/fs/index.cjs +71 -37
  37. package/fs/index.d.ts +206 -2
  38. package/fs/index.mjs +65 -35
  39. package/http-status-codes/index.cjs +1 -1
  40. package/http-status-codes/index.d.ts +268 -2
  41. package/http-status-codes/index.mjs +1 -1
  42. package/id/index.cjs +1 -1
  43. package/id/index.d.ts +38 -2
  44. package/id/index.mjs +1 -1
  45. package/index.cjs +13 -13
  46. package/index.d.ts +5 -5
  47. package/index.mjs +5 -5
  48. package/logger/index.cjs +13 -15
  49. package/logger/index.d.ts +190 -2
  50. package/logger/index.mjs +14 -16
  51. package/middleware/index.cjs +1 -1
  52. package/middleware/index.d.ts +104 -2
  53. package/middleware/index.mjs +1 -1
  54. package/object/index.cjs +379 -0
  55. package/{obj/obj.utils.d.ts → object/index.d.ts} +73 -33
  56. package/object/index.mjs +360 -0
  57. package/package.json +41 -23
  58. package/performance/index.cjs +4 -4
  59. package/performance/index.d.ts +139 -2
  60. package/performance/index.mjs +4 -4
  61. package/request/index.cjs +37 -25
  62. package/request/index.d.ts +242 -3
  63. package/request/index.mjs +37 -25
  64. package/response/index.cjs +1 -1
  65. package/response/index.d.ts +319 -3
  66. package/response/index.mjs +1 -1
  67. package/server/index.cjs +249 -146
  68. package/server/index.d.ts +866 -5
  69. package/server/index.mjs +248 -144
  70. package/stream/index.cjs +1 -1
  71. package/stream/index.d.ts +91 -2
  72. package/stream/index.mjs +1 -1
  73. package/string/index.cjs +34 -1
  74. package/string/index.d.ts +146 -2
  75. package/string/index.mjs +31 -2
  76. package/type/index.cjs +19 -2
  77. package/type/index.d.ts +144 -2
  78. package/type/index.mjs +17 -3
  79. package/types/index.cjs +1 -1
  80. package/types/index.d.ts +775 -5
  81. package/types/index.mjs +1 -1
  82. package/url/index.cjs +63 -5
  83. package/url/index.d.ts +200 -2
  84. package/url/index.mjs +59 -6
  85. package/{validate → validation}/index.cjs +91 -44
  86. package/{validate/validate.utils.d.ts → validation/index.d.ts} +33 -24
  87. package/{validate → validation}/index.mjs +87 -44
  88. package/array/array.utils.d.ts +0 -191
  89. package/async/async.utils.d.ts +0 -296
  90. package/cache/cache.utils.d.ts +0 -176
  91. package/config/config.d.ts +0 -57
  92. package/context-store/context-store.utils.d.ts +0 -212
  93. package/crypto/crypto.utils.d.ts +0 -183
  94. package/date/date.utils.d.ts +0 -190
  95. package/decorators/index.cjs +0 -913
  96. package/decorators/index.d.ts +0 -25
  97. package/decorators/index.mjs +0 -872
  98. package/dir/index.d.ts +0 -25
  99. package/env/env.utils.d.ts +0 -400
  100. package/exception/exception.utils.d.ts +0 -253
  101. package/fs/fs.utils.d.ts +0 -196
  102. package/http-status-codes/http-status-codes.d.ts +0 -289
  103. package/id/id.utils.d.ts +0 -59
  104. package/logger/logger.utils.d.ts +0 -210
  105. package/middleware/middleware.utils.d.ts +0 -123
  106. package/obj/index.cjs +0 -317
  107. package/obj/index.d.ts +0 -25
  108. package/obj/index.mjs +0 -301
  109. package/performance/performance.utils.d.ts +0 -159
  110. package/request/request.utils.d.ts +0 -109
  111. package/response/response.utils.d.ts +0 -186
  112. package/server/server.builder.d.ts +0 -531
  113. package/server/server.d.ts +0 -303
  114. package/stream/stream.utils.d.ts +0 -111
  115. package/string/string.utils.d.ts +0 -124
  116. package/type/type.utils.d.ts +0 -129
  117. package/types/api-response.d.ts +0 -175
  118. package/types/common.d.ts +0 -148
  119. package/types/config.d.ts +0 -88
  120. package/types/server.d.ts +0 -291
  121. package/url/url.utils.d.ts +0 -164
  122. package/validate/index.d.ts +0 -25
package/fs/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * The MIT License
3
3
  *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -22,4 +22,208 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- export * from './fs.utils';
25
+ import { BufferEncoding } from '@catbee/utils/crypto';
26
+ import fs from 'node:fs';
27
+
28
+ /**
29
+ * Checks whether a file or directory exists at the given path.
30
+ *
31
+ * @param {string} path - The file or directory path to check.
32
+ * @returns {Promise<boolean>} Resolves to `true` if the path exists, `false` otherwise.
33
+ */
34
+ declare function fileExists(path: string): Promise<boolean>;
35
+ /**
36
+ * Reads and parses a JSON file from the specified path.
37
+ *
38
+ * @typeParam T - The expected type of the parsed JSON object.
39
+ * @param {string} path - The path to the JSON file.
40
+ * @returns {Promise<T | null>} The parsed object, or `null` if reading or parsing fails.
41
+ */
42
+ declare function readJsonFile<T = any>(path: string): Promise<T | null>;
43
+ /**
44
+ * Read and parse JSON file or return a provided default value on error.
45
+ *
46
+ * @typeParam T
47
+ * @param {string} path - Path to JSON file
48
+ * @param {T} defaultValue - Default value to return when read/parse fails
49
+ * @returns {Promise<T>} Parsed JSON or defaultValue
50
+ */
51
+ declare function readJsonOrDefault<T = any>(path: string, defaultValue: T): Promise<T>;
52
+ /**
53
+ * Writes a JavaScript object to a file as formatted JSON.
54
+ *
55
+ * @param {string} path - The destination file path.
56
+ * @param {any} data - The object to serialize and write.
57
+ * @param {number} [space=2] - Number of spaces for JSON formatting.
58
+ * @returns {Promise<void>} Resolves when writing is complete.
59
+ */
60
+ declare function writeJsonFile(path: string, data: any, space?: number): Promise<void>;
61
+ /**
62
+ * Deletes a file if it exists.
63
+ *
64
+ * @param {string} path - The file path to delete.
65
+ * @returns {Promise<boolean>} Resolves to `true` if the file was deleted or didn't exist, `false` if deletion failed.
66
+ */
67
+ declare function deleteFileIfExists(path: string): Promise<boolean>;
68
+ /**
69
+ * Reads a file from the specified path.
70
+ *
71
+ * @param {string} path - The path to the file.
72
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
73
+ * @returns {Promise<string | null>} The file contents, or `null` if reading fails.
74
+ */
75
+ declare function readFile(path: string, encoding?: BufferEncoding): Promise<string>;
76
+ /**
77
+ * Reads a file from the specified path synchronously.
78
+ *
79
+ * @param {string} path - The path to the file.
80
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
81
+ * @returns {string | null} The file contents, or `null` if reading fails.
82
+ */
83
+ declare function readFileSync(path: string, encoding?: BufferEncoding): string;
84
+ /**
85
+ * Safely reads a file and returns its content along with any error encountered.
86
+ *
87
+ * @param {string} path - The path to the file.
88
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
89
+ * @returns {Promise<{ data: string | null; error: Error | null }>} Object with data and error properties.
90
+ */
91
+ declare function safeReadFile(path: string, encoding?: BufferEncoding): Promise<{
92
+ data: string | null;
93
+ error: Error | null;
94
+ }>;
95
+ /**
96
+ * Safely reads a file synchronously and returns its content along with any error encountered.
97
+ *
98
+ * @param {string} path - The path to the file.
99
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
100
+ * @returns {{ data: string | null; error: Error | null }} Object with data and error properties.
101
+ */
102
+ declare function safeReadFileSync(path: string, encoding?: BufferEncoding): {
103
+ data: string | null;
104
+ error: Error | null;
105
+ };
106
+ /**
107
+ * Writes content to a file.
108
+ *
109
+ * @param {string} path - The destination file path.
110
+ * @param {string} content - The text content to write.
111
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
112
+ * @returns {Promise<boolean>} Resolves to `true` if successful, `false` otherwise.
113
+ */
114
+ declare function writeFile(path: string, content: string, encoding?: BufferEncoding): Promise<boolean>;
115
+ /**
116
+ * Appends text content to a file.
117
+ *
118
+ * @param {string} path - The file path to append to.
119
+ * @param {string} content - The text content to append.
120
+ * @param {BufferEncoding} [encoding="utf-8"] - The encoding to use.
121
+ * @returns {Promise<boolean>} Resolves to `true` if successful, `false` otherwise.
122
+ */
123
+ declare function appendFile(path: string, content: string, encoding?: BufferEncoding): Promise<boolean>;
124
+ /**
125
+ * Copies a file from source to destination.
126
+ *
127
+ * @param {string} source - Source file path.
128
+ * @param {string} destination - Destination file path.
129
+ * @param {boolean} [overwrite=false] - Whether to overwrite if destination exists.
130
+ * @returns {Promise<boolean>} Resolves to `true` if successful, `false` otherwise.
131
+ */
132
+ declare function copyFile(source: string, destination: string, overwrite?: boolean): Promise<boolean>;
133
+ /**
134
+ * Renames/moves a file.
135
+ *
136
+ * @param {string} oldPath - Current file path.
137
+ * @param {string} newPath - New file path.
138
+ * @returns {Promise<boolean>} Resolves to `true` if successful, `false` otherwise.
139
+ */
140
+ declare function moveFile(oldPath: string, newPath: string): Promise<boolean>;
141
+ /**
142
+ * Gets file stats if the file exists.
143
+ *
144
+ * @param {string} path - Path to the file.
145
+ * @returns {Promise<fsp.Stats | null>} File stats object or null if file doesn't exist.
146
+ */
147
+ declare function getFileStats(path: string): Promise<fs.Stats | null>;
148
+ /**
149
+ * Creates a temporary file with optional content.
150
+ *
151
+ * @param {object} [options] - Options for creating the temp file.
152
+ * @param {string} [options.prefix="tmp-"] - Filename prefix.
153
+ * @param {string} [options.extension=""] - File extension.
154
+ * @param {string} [options.dir] - Directory to create the file in (defaults to OS temp dir).
155
+ * @param {string | Buffer} [options.content] - Optional content to write to the file.
156
+ * @returns {Promise<string>} Path to the created temporary file.
157
+ */
158
+ declare function createTempFile({ prefix, extension, dir, content }?: {
159
+ prefix?: string;
160
+ extension?: string;
161
+ dir?: string;
162
+ content?: string | Buffer;
163
+ }): Promise<string>;
164
+ /**
165
+ * Streams a file from source to destination.
166
+ * Useful for large files to avoid loading the entire file into memory.
167
+ *
168
+ * @param {string} source - Source file path.
169
+ * @param {string} destination - Destination file path.
170
+ * @returns {Promise<void>} Resolves when streaming completes.
171
+ * @throws {Error} If streaming fails.
172
+ */
173
+ declare function streamFile(source: string, destination: string): Promise<void>;
174
+ /**
175
+ * Reads a directory and returns file names.
176
+ *
177
+ * @param {string} dirPath - Path to the directory.
178
+ * @param {object} [options] - Options for reading the directory.
179
+ * @param {boolean} [options.fullPaths=false] - Whether to return full paths.
180
+ * @param {RegExp} [options.filter] - Optional regex to filter files.
181
+ * @returns {Promise<string[]>} Array of file names or paths.
182
+ * @throws {Error} If directory cannot be read.
183
+ */
184
+ declare function readDirectory(dirPath: string, options?: {
185
+ fullPaths?: boolean;
186
+ filter?: RegExp;
187
+ }): Promise<string[]>;
188
+ /**
189
+ * Creates a directory if it doesn't exist.
190
+ *
191
+ * @param {string} dirPath - Path to the directory.
192
+ * @param {boolean} [recursive=true] - Whether to create parent directories.
193
+ * @returns {Promise<boolean>} Resolves to `true` if successful, `false` otherwise.
194
+ */
195
+ declare function createDirectory(dirPath: string, recursive?: boolean): Promise<boolean>;
196
+ /**
197
+ * Safely reads and parses a JSON file with error details.
198
+ *
199
+ * @typeParam T - The expected type of the parsed JSON object.
200
+ * @param {string} path - The path to the JSON file.
201
+ * @returns {Promise<{ data: T | null; error: Error | null }>} Object with data and error properties.
202
+ */
203
+ declare function safeReadJsonFile<T = any>(path: string): Promise<{
204
+ data: T | null;
205
+ error: Error | null;
206
+ }>;
207
+ /**
208
+ * Checks if a path points to a file (not a directory).
209
+ *
210
+ * @param {string} path - Path to check.
211
+ * @returns {Promise<boolean>} True if the path is a file, false otherwise.
212
+ */
213
+ declare function isFile(path: string): Promise<boolean>;
214
+ /**
215
+ * Gets the size of a file in bytes.
216
+ *
217
+ * @param {string} path - Path to the file.
218
+ * @returns {Promise<number>} Size in bytes or -1 if file doesn't exist.
219
+ */
220
+ declare function getFileSize(path: string): Promise<number>;
221
+ /**
222
+ * Reads a file as a Buffer.
223
+ *
224
+ * @param {string} path - Path to the file.
225
+ * @returns {Promise<Buffer | null>} File contents as Buffer or null if reading fails.
226
+ */
227
+ declare function readFileBuffer(path: string): Promise<Buffer | null>;
228
+
229
+ export { appendFile, copyFile, createDirectory, createTempFile, deleteFileIfExists, fileExists, getFileSize, getFileStats, isFile, moveFile, readDirectory, readFile, readFileBuffer, readFileSync, readJsonFile, readJsonOrDefault, safeReadFile, safeReadFileSync, safeReadJsonFile, streamFile, writeFile, writeJsonFile };
package/fs/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * The MIT License
3
3
  *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -22,8 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { createReadStream, createWriteStream } from 'fs';
26
- import fs from 'fs/promises';
25
+ import fs from 'fs';
26
+ import fsp from 'fs/promises';
27
27
  import { tmpdir } from 'os';
28
28
  import path from 'path';
29
29
  import { pipeline } from 'stream/promises';
@@ -33,7 +33,7 @@ var __defProp = Object.defineProperty;
33
33
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
34
34
  async function fileExists(path2) {
35
35
  try {
36
- await fs.access(path2);
36
+ await fsp.access(path2);
37
37
  return true;
38
38
  } catch {
39
39
  return false;
@@ -42,7 +42,7 @@ async function fileExists(path2) {
42
42
  __name(fileExists, "fileExists");
43
43
  async function readJsonFile(path2) {
44
44
  try {
45
- const data = await fs.readFile(path2, "utf-8");
45
+ const data = await fsp.readFile(path2, "utf-8");
46
46
  return JSON.parse(data);
47
47
  } catch {
48
48
  return null;
@@ -56,12 +56,12 @@ async function readJsonOrDefault(path2, defaultValue) {
56
56
  __name(readJsonOrDefault, "readJsonOrDefault");
57
57
  async function writeJsonFile(path2, data, space = 2) {
58
58
  const json = JSON.stringify(data, null, space);
59
- await fs.writeFile(path2, json, "utf-8");
59
+ await fsp.writeFile(path2, json, "utf-8");
60
60
  }
61
61
  __name(writeJsonFile, "writeJsonFile");
62
62
  async function deleteFileIfExists(path2) {
63
63
  try {
64
- await fs.unlink(path2);
64
+ await fsp.unlink(path2);
65
65
  return true;
66
66
  } catch (err) {
67
67
  if (err.code === "ENOENT") return true;
@@ -69,36 +69,66 @@ async function deleteFileIfExists(path2) {
69
69
  }
70
70
  }
71
71
  __name(deleteFileIfExists, "deleteFileIfExists");
72
- async function readTextFile(path2, encoding = "utf-8") {
72
+ async function readFile(path2, encoding = "utf-8") {
73
+ return await fsp.readFile(path2, encoding);
74
+ }
75
+ __name(readFile, "readFile");
76
+ function readFileSync(path2, encoding = "utf-8") {
77
+ return fs.readFileSync(path2, encoding);
78
+ }
79
+ __name(readFileSync, "readFileSync");
80
+ async function safeReadFile(path2, encoding = "utf-8") {
73
81
  try {
74
- return await fs.readFile(path2, encoding);
75
- } catch {
76
- return null;
82
+ const data = await fsp.readFile(path2, encoding);
83
+ return {
84
+ data,
85
+ error: null
86
+ };
87
+ } catch (error) {
88
+ return {
89
+ data: null,
90
+ error: new Error(`Failed to read file ${path2}: ${error.message}`)
91
+ };
92
+ }
93
+ }
94
+ __name(safeReadFile, "safeReadFile");
95
+ function safeReadFileSync(path2, encoding = "utf-8") {
96
+ try {
97
+ const data = fs.readFileSync(path2, encoding);
98
+ return {
99
+ data,
100
+ error: null
101
+ };
102
+ } catch (error) {
103
+ return {
104
+ data: null,
105
+ error: new Error(`Failed to read file ${path2}: ${error.message}`)
106
+ };
77
107
  }
78
108
  }
79
- __name(readTextFile, "readTextFile");
80
- async function writeTextFile(path2, content, encoding = "utf-8") {
109
+ __name(safeReadFileSync, "safeReadFileSync");
110
+ async function writeFile(path2, content, encoding = "utf-8") {
81
111
  try {
82
- await fs.writeFile(path2, content, encoding);
112
+ await fsp.writeFile(path2, content, encoding);
83
113
  return true;
84
114
  } catch {
85
115
  return false;
86
116
  }
87
117
  }
88
- __name(writeTextFile, "writeTextFile");
89
- async function appendTextFile(path2, content, encoding = "utf-8") {
118
+ __name(writeFile, "writeFile");
119
+ async function appendFile(path2, content, encoding = "utf-8") {
90
120
  try {
91
- await fs.appendFile(path2, content, encoding);
121
+ await fsp.appendFile(path2, content, encoding);
92
122
  return true;
93
123
  } catch {
94
124
  return false;
95
125
  }
96
126
  }
97
- __name(appendTextFile, "appendTextFile");
127
+ __name(appendFile, "appendFile");
98
128
  async function copyFile(source, destination, overwrite = false) {
99
129
  try {
100
- const flags = overwrite ? 0 : fs.constants.COPYFILE_EXCL;
101
- await fs.copyFile(source, destination, flags);
130
+ const flags = overwrite ? 0 : fsp.constants.COPYFILE_EXCL;
131
+ await fsp.copyFile(source, destination, flags);
102
132
  return true;
103
133
  } catch {
104
134
  return false;
@@ -107,12 +137,12 @@ async function copyFile(source, destination, overwrite = false) {
107
137
  __name(copyFile, "copyFile");
108
138
  async function moveFile(oldPath, newPath) {
109
139
  try {
110
- await fs.rename(oldPath, newPath);
140
+ await fsp.rename(oldPath, newPath);
111
141
  return true;
112
142
  } catch {
113
143
  try {
114
- await fs.copyFile(oldPath, newPath);
115
- await fs.unlink(oldPath);
144
+ await fsp.copyFile(oldPath, newPath);
145
+ await fsp.unlink(oldPath);
116
146
  return true;
117
147
  } catch {
118
148
  return false;
@@ -122,7 +152,7 @@ async function moveFile(oldPath, newPath) {
122
152
  __name(moveFile, "moveFile");
123
153
  async function getFileStats(path2) {
124
154
  try {
125
- return await fs.stat(path2);
155
+ return await fsp.stat(path2);
126
156
  } catch {
127
157
  return null;
128
158
  }
@@ -133,16 +163,16 @@ async function createTempFile({ prefix = "tmp-", extension = "", dir = tmpdir(),
133
163
  const filename = `${prefix}${randomUUID()}${ext}`;
134
164
  const filepath = path.join(dir, filename);
135
165
  if (content) {
136
- await fs.writeFile(filepath, content);
166
+ await fsp.writeFile(filepath, content);
137
167
  } else {
138
- await fs.writeFile(filepath, "");
168
+ await fsp.writeFile(filepath, "");
139
169
  }
140
170
  return filepath;
141
171
  }
142
172
  __name(createTempFile, "createTempFile");
143
173
  async function streamFile(source, destination) {
144
- const readStream = createReadStream(source);
145
- const writeStream = createWriteStream(destination);
174
+ const readStream = fs.createReadStream(source);
175
+ const writeStream = fs.createWriteStream(destination);
146
176
  try {
147
177
  await pipeline(readStream, writeStream);
148
178
  } catch (error) {
@@ -153,7 +183,7 @@ async function streamFile(source, destination) {
153
183
  }
154
184
  __name(streamFile, "streamFile");
155
185
  async function readDirectory(dirPath, options = {}) {
156
- const files = await fs.readdir(dirPath);
186
+ const files = await fsp.readdir(dirPath);
157
187
  let result = files;
158
188
  if (options.filter) {
159
189
  result = result.filter((file) => options.filter.test(file));
@@ -166,7 +196,7 @@ async function readDirectory(dirPath, options = {}) {
166
196
  __name(readDirectory, "readDirectory");
167
197
  async function createDirectory(dirPath, recursive = true) {
168
198
  try {
169
- await fs.mkdir(dirPath, {
199
+ await fsp.mkdir(dirPath, {
170
200
  recursive
171
201
  });
172
202
  return true;
@@ -177,7 +207,7 @@ async function createDirectory(dirPath, recursive = true) {
177
207
  __name(createDirectory, "createDirectory");
178
208
  async function safeReadJsonFile(path2) {
179
209
  try {
180
- const content = await fs.readFile(path2, "utf-8");
210
+ const content = await fsp.readFile(path2, "utf-8");
181
211
  try {
182
212
  const data = JSON.parse(content);
183
213
  return {
@@ -200,7 +230,7 @@ async function safeReadJsonFile(path2) {
200
230
  __name(safeReadJsonFile, "safeReadJsonFile");
201
231
  async function isFile(path2) {
202
232
  try {
203
- const stat = await fs.stat(path2);
233
+ const stat = await fsp.stat(path2);
204
234
  return stat.isFile();
205
235
  } catch {
206
236
  return false;
@@ -209,7 +239,7 @@ async function isFile(path2) {
209
239
  __name(isFile, "isFile");
210
240
  async function getFileSize(path2) {
211
241
  try {
212
- const stat = await fs.stat(path2);
242
+ const stat = await fsp.stat(path2);
213
243
  return stat.size;
214
244
  } catch {
215
245
  return -1;
@@ -218,11 +248,11 @@ async function getFileSize(path2) {
218
248
  __name(getFileSize, "getFileSize");
219
249
  async function readFileBuffer(path2) {
220
250
  try {
221
- return await fs.readFile(path2);
251
+ return await fsp.readFile(path2);
222
252
  } catch {
223
253
  return null;
224
254
  }
225
255
  }
226
256
  __name(readFileBuffer, "readFileBuffer");
227
257
 
228
- export { appendTextFile, copyFile, createDirectory, createTempFile, deleteFileIfExists, fileExists, getFileSize, getFileStats, isFile, moveFile, readDirectory, readFileBuffer, readJsonFile, readJsonOrDefault, readTextFile, safeReadJsonFile, streamFile, writeJsonFile, writeTextFile };
258
+ export { appendFile, copyFile, createDirectory, createTempFile, deleteFileIfExists, fileExists, getFileSize, getFileStats, isFile, moveFile, readDirectory, readFile, readFileBuffer, readFileSync, readJsonFile, readJsonOrDefault, safeReadFile, safeReadFileSync, safeReadJsonFile, streamFile, writeFile, writeJsonFile };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * The MIT License
3
3
  *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal