async-file-tried 1.2.1 → 1.2.3

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/README.md CHANGED
@@ -9,10 +9,6 @@ Write more linear, better readable code by getting a concise response. Dependenc
9
9
  [![Coverage Status](https://coveralls.io/repos/github/fwalzel/async-file-tried/badge.svg?branch=main)](https://coveralls.io/github/fwalzel/async-file-tried?branch=main)
10
10
  [![Known Vulnerabilities](https://snyk.io/test/github/fwalzel/async-file-tried/badge.svg)](https://snyk.io/test/github/fwalzel/async-file-tried/badge.svg)
11
11
 
12
- ## License
13
-
14
- Copyright (c) 2023–24 Florian Walzel,
15
- MIT License
16
12
 
17
13
  ## Install
18
14
 
@@ -64,179 +60,611 @@ let [res, err] = await fs.appendFile(
64
60
 
65
61
  ... and the path string will be composed automatically.
66
62
 
67
- ## Public Functions
63
+ ## Public Functions (FS Function List)
64
+
65
+ ### [fs.access](https://nodejs.org/api/fs.html#fspromisesaccesspath-mode)
66
+
67
+ Tests a user's permissions for the file or directory specified by `path`.
68
+
69
+ Typescript implementation:
70
+ ```typescript
71
+ async (path: string|Array<string>, mode?: number|string)
72
+ ```
73
+
74
+ Usage example:
75
+ ```javascript
76
+ let [res, err] = await fs.access('file.txt', fs.constants.R_OK);
77
+ ```
78
+
79
+ ---
80
+
81
+ ### [fs.appendFile](https://nodejs.org/api/fs.html#fspromisesappendfilepath-data-options)
82
+
83
+ Asynchronously appends data to a file, creating the file if it does not exist.
84
+
85
+ Typescript implementation:
86
+ ```typescript
87
+ async (path: string|Array<string>, data: any, options?: { encoding?: Encoding; mode?: number|string; flag?: Flags; })
88
+ ```
89
+
90
+ Usage example:
91
+ ```javascript
92
+ let [res, err] = await fs.appendFile('file.txt', 'foo');
93
+ ```
94
+
95
+ ---
96
+
97
+ ### [fs.chmod](https://nodejs.org/api/fs.html#filehandlechmodmode)
98
+
99
+ Changes the permissions of a file or directory.
100
+
101
+ Typescript implementation:
102
+ ```typescript
103
+ async (path: string|Array<string>, mode?: number|string)
104
+ ```
105
+
106
+ Usage example:
107
+ ```javascript
108
+ let [res, err] = await fs.chmod('file.txt', '755');
109
+ ```
110
+
111
+ ---
112
+
113
+ ### [fs.chown](https://nodejs.org/api/fs.html#filehandlechownuid-gid)
114
+
115
+ Changes the ownership of a file by setting the user ID and group ID.
116
+
117
+ Typescript implementation:
118
+ ```typescript
119
+ async (path: string|Array<string>, uid: number, gid: number)
120
+ ```
121
+
122
+ Usage example:
123
+ ```javascript
124
+ let [res, err] = await fs.chown('file.txt', 1541, 999);
125
+ ```
126
+
127
+ ---
128
+
129
+ ### [fs.copyFile](https://nodejs.org/api/fs.html#fspromisescopyfilesrc-dest-mode)
130
+
131
+ Copies a file from one location to another.
132
+
133
+ Typescript implementation:
134
+ ```typescript
135
+ async (srcPath: string|Array<string>, destPath: string|Array<string>, flags?: number)
136
+ ```
137
+
138
+ Usage example:
139
+ ```javascript
140
+ let [res, err] = await fs.copyFile('file.txt', 'file-copy.txt');
141
+ ```
142
+
143
+ ---
144
+
145
+ ### [fs.cp](https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options)
146
+
147
+ Recursively copies files and directories from one location to another.
148
+
149
+ Typescript implementation:
150
+ ```typescript
151
+ async (srcPath: string|Array<string>, destPath: string|Array<string>)
152
+ ```
153
+
154
+ Usage example:
155
+ ```javascript
156
+ let [res, err] = await fs.cp('myfolder', 'myfolder-copy', { recursive: true });
157
+ ```
158
+
159
+ ---
160
+
161
+ ### [fs.lchmod](https://nodejs.org/api/fs.html#fspromiseslchmodpath-mode)
162
+
163
+ Changes the permissions of a symbolic link.
164
+
165
+ Typescript implementation:
166
+ ```typescript
167
+ async (path: string|Array<string>, mode?: number|string)
168
+ ```
169
+
170
+ Usage example:
171
+ ```javascript
172
+ let [res, err] = await fs.lchmod('symlink.txt', '755');
173
+ ```
174
+
175
+ ---
176
+
177
+ ### [fs.lchown](https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid)
178
+
179
+ Changes the ownership of a symbolic link.
180
+
181
+ Typescript implementation:
182
+ ```typescript
183
+ async (path: string|Array<string>, uid: number, gid: number)
184
+ ```
185
+
186
+ Usage example:
187
+ ```javascript
188
+ let [res, err] = await fs.lchown('./test/static-testfiles/symlinkToFile-append.txt', 1200, 1201);
189
+ ```
190
+
191
+ ---
192
+
193
+ ### [fs.link](https://nodejs.org/api/fs.html#fspromiseslinkexistingpath-newpath)
194
+
195
+ Creates a new hard link to an existing file.
196
+
197
+ Typescript implementation:
198
+ ```typescript
199
+ async (existingPath: string|Array<string>, newPath: string|Array<string>)
200
+ ```
201
+
202
+ Usage example:
203
+ ```javascript
204
+ let [res, err] = await fs.link('file.txt', 'file-hard-link.txt');
205
+ ```
206
+
207
+ ---
208
+
209
+ ### [fs.lstat](https://nodejs.org/api/fs.html#fspromiseslstatpath-options)
210
+
211
+ Retrieves information about a symbolic link or file without following the link.
212
+
213
+ Typescript implementation:
214
+ ```typescript
215
+ async (path: string|Array<string>, options?: object)
216
+ ```
217
+
218
+ Usage example:
219
+ ```javascript
220
+ let [res, err] = await fs.lstat('symlinkToFile.txt');
221
+ ```
222
+
223
+ ---
224
+
225
+ ### [fs.lutimes](https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime)
226
+
227
+ Changes the access and modification times of a symbolic link.
228
+
229
+ Typescript implementation:
230
+ ```typescript
231
+ async (path: string|Array<string>, atime: Date|number, mtime: Date|number)
232
+ ```
233
+
234
+ Usage example:
235
+ ```javascript
236
+ let [res, err] = await fs.lutimes('file.txt', new Date(), new Date());
237
+ ```
238
+
239
+ ---
240
+
241
+ ### [fs.mkdir](https://nodejs.org/api/fs.html#fspromisesmkdirpath-options)
242
+
243
+ Creates a new directory at the specified path.
244
+
245
+ Typescript implementation:
246
+ ```typescript
247
+ async (path: string|Array<string>, options?: number|string)
248
+ ```
249
+
250
+ Usage example:
251
+ ```javascript
252
+ let [res, err] = await fs.mkdir('./my-new-folder');
253
+ ```
254
+
255
+ ---
256
+
257
+ ### [fs.mkdtemp](https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options)
258
+
259
+ Creates a uniquely named temporary directory.
260
+
261
+ Typescript implementation:
262
+ ```typescript
263
+ async (prefix: string, encoding?: Encoding)
264
+ ```
265
+
266
+ Usage example:
267
+ ```javascript
268
+ let [res, err] = await fs.mkdtemp('temp-');
269
+ ```
270
+
271
+ ---
272
+
273
+ ### [fs.open](https://nodejs.org/api/fs.html#fspromisesopenpath-flags-mode)
274
+
275
+ Opens a file and returns a file handle for reading or writing.
276
+
277
+ Typescript implementation:
278
+ ```typescript
279
+ async (path: string|Array<string>, flags?: Flags, mode?: number|string)
280
+ ```
281
+
282
+ Usage example:
283
+ ```javascript
284
+ let [res, err] = await fs.open('file.txt', 'r');
285
+ ```
286
+
287
+ ---
288
+
289
+ ### [fs.opendir](https://nodejs.org/api/fs.html#fspromisesopendirpath-options)
290
+
291
+ Opens a directory for reading and returns a directory handle.
292
+
293
+ Typescript implementation:
294
+ ```typescript
295
+ async (path: string|Array<string>, flags?: Flags, mode?: number|string)
296
+ ```
297
+
298
+ Usage example:
299
+ ```javascript
300
+ let [res, err] = await fs.opendir('./test', { encoding: "utf8", bufferSize: 64 });
301
+ ```
302
+
303
+ ---
304
+
305
+ ### [fs.readFile](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
306
+
307
+ Reads the contents of a file into memory.
308
+
309
+ Typescript implementation:
310
+ ```typescript
311
+ async (path: string|Array<string>, options?: Encoding)
312
+ ```
313
+
314
+ Usage example:
315
+ ```javascript
316
+ let [res, err] = await fs.readFile('file.txt', 'utf8');
317
+ ```
318
+
319
+ ---
320
+
321
+ ### [fs.readdir](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
322
+
323
+ Reads the contents of a directory.
324
+
325
+ Typescript implementation:
326
+ ```typescript
327
+ async (path: string|Array<string>, options?: object)
328
+ ```
329
+
330
+ Usage example:
331
+ ```javascript
332
+ let [res, err] = await fs.readdir('./my-directory');
333
+ ```
334
+
335
+ ---
336
+
337
+ ### [fs.readlink](https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options)
338
+
339
+ Reads the value of a symbolic link.
340
+
341
+ Typescript implementation:
342
+ ```typescript
343
+ async (path: string|Array<string>, options?: object|string)
344
+ ```
345
+
346
+ Usage example:
347
+ ```javascript
348
+ let [res, err] = await fs.readlink('symlinkToFile.txt');
349
+ ```
350
+
351
+ ---
352
+
353
+ ### [fs.realpath](https://nodejs.org/api/fs.html#fspromisesrealpathpath-options)
354
+
355
+ Resolves a path to its absolute real path, resolving symlinks.
356
+
357
+ Typescript implementation:
358
+ ```typescript
359
+ async (path: string|Array<string>, options?: object)
360
+ ```
361
+
362
+ Usage example:
363
+ ```javascript
364
+ let [res, err] = await fs.realpath('./my-folder/../');
365
+ ```
68
366
 
69
- ### FS Function List
367
+ ---
70
368
 
71
- - [fs.access](https://nodejs.org/api/fs.html#fspromisesaccesspath-mode)
72
- + Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
73
- + Usage example: `let [res, err] = await fs.access('file.txt', fs.constants.R_OK);`
369
+ ### [fs.rename](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
74
370
 
75
- - [fs.appendFile](https://nodejs.org/api/fs.html#fspromisesappendfilepath-data-options)
76
- + Typescript implementation: `async (path: string|Array<string>, data: any, options?: { encoding?: Encoding; mode?: number|string; flag?: Flags; })`
77
- + Usage example: `let [res, err] = await fs.appendFile('file.txt', 'foo');`
371
+ Renames or moves a file or directory.
78
372
 
79
- - [fs.chmod](https://nodejs.org/api/fs.html#filehandlechmodmode)
80
- + Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
81
- + Usage example: `let [res, err] = await fs.chmod('file.txt', '755');`
373
+ Typescript implementation:
374
+ ```typescript
375
+ async (oldPath: string|Array<string>, newPath: string|Array<string>)
376
+ ```
377
+
378
+ Usage example:
379
+ ```javascript
380
+ let [res, err] = await fs.rename('old.txt', 'new.txt');
381
+ ```
82
382
 
83
- - [fs.chown](https://nodejs.org/api/fs.html#filehandlechownuid-gid)
84
- + Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
85
- + Usage example: `let [res, err] = await fs.chown('file.txt', 1541, 999);`
383
+ ---
384
+
385
+ ### [fs.rm](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
386
+
387
+ Removes files or directories.
388
+
389
+ Typescript implementation:
390
+ ```typescript
391
+ async (path: string|Array<string>, options?: object)
392
+ ```
393
+
394
+ Usage example:
395
+ ```javascript
396
+ let [res, err] = await fs.rm('file.txt');
397
+ ```
398
+
399
+ ---
400
+
401
+ ### [fs.rmdir](https://nodejs.org/api/fs.html#fspromisesrmdirpath-options)
402
+
403
+ Removes a directory.
404
+
405
+ Typescript implementation:
406
+ ```typescript
407
+ async (path: string|Array<string>, options?: object)
408
+ ```
409
+
410
+ Usage example:
411
+ ```javascript
412
+ let [res, err] = await fs.rmdir('./my-folder');
413
+ ```
414
+
415
+ ---
416
+
417
+ ### [fs.stat](https://nodejs.org/api/fs.html#fspromisesstatpath-options)
418
+
419
+ Retrieves information about a file or directory.
420
+
421
+ Typescript implementation:
422
+ ```typescript
423
+ async (path: string|Array<string>, options?: object)
424
+ ```
425
+
426
+ Usage example:
427
+ ```javascript
428
+ let [res, err] = await fs.stat('file.txt');
429
+ ```
430
+
431
+ ---
432
+
433
+ ### [fs.symlink](https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type)
434
+
435
+ Creates a symbolic link to a target file or directory.
436
+
437
+ Typescript implementation:
438
+ ```typescript
439
+ async (target: string|Array<string>, path: string|Array<string>, type?: string)
440
+ ```
441
+
442
+ Usage example:
443
+ ```javascript
444
+ let [res, err] = await fs.symlink('file.txt', 'file-symlink.txt', 'file');
445
+ ```
86
446
 
87
- - [fs.copyFile](https://nodejs.org/api/fs.html#fspromisescopyfilesrc-dest-mode)
88
- + Typescript implementation: `async (srcPath: string|Array<string>, destPath: string|Array<string>,flags?: number)`
89
- + Usage example: `let [res, err] = await fs.copyFile('file.txt', 'file-copy.txt');`
447
+ ---
90
448
 
91
- - [fs.cp](https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options)
92
- + Typescript implementation: `async (srcPath: string|Array<string>, destPath: string|Array<string>)`
93
- + Usage example: `let [res, err] = await fs.cp('myfolder', 'myfolder-copy', {recursive: true});`
449
+ ### [fs.truncate](https://nodejs.org/api/fs.html#fspromisestruncatepath-len)
94
450
 
95
- - [fs.lchmod](https://nodejs.org/api/fs.html#fspromiseslchmodpath-mode)
96
- + Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
97
- + Usage example: ``
451
+ Truncates a file to a specified length.
98
452
 
99
- - [fs.lchown](https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid)
100
- + Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
101
- + Usage example: `let [res, err] = await fs.lchown('./test/static-testfiles/symlinkToFile-append.txt', 1200, 1201);`
453
+ Typescript implementation:
454
+ ```typescript
455
+ async (path: string|Array<string>, len: number)
456
+ ```
102
457
 
103
- - [fs.link](https://nodejs.org/api/fs.html#fspromiseslinkexistingpath-newpath)
104
- + Typescript implementation: `async (existingPath: string|Array<string>, newPath: string|Array<string>)`
105
- + Usage example: `let [res, err] = await fs.link('file.txt', 'file-hard-link.txt');`
458
+ Usage example:
459
+ ```javascript
460
+ let [res, err] = await fs.truncate('file.txt', 760);
461
+ ```
106
462
 
107
- - [fs.lstat](https://nodejs.org/api/fs.html#fspromiseslstatpath-options)
108
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
109
- + Usage example: `let [res, err] = await fs.lstat('symlinkToFile.txt');`
463
+ ---
110
464
 
111
- - [fs.lutimes](https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime)
112
- + Typescript implementation: `async (path: string|Array<string>, atime: Date|number, mtime: Date|number)`
113
- + Usage example: `let [res, err] = await fs.lutimes('file.txt', new Date(), new Date());`
465
+ ### [fs.unlink](https://nodejs.org/api/fs.html#fspromisesunlinkpath)
114
466
 
115
- - [fs.mkdir](https://nodejs.org/api/fs.html#fspromisesmkdirpath-options)
116
- + Typescript implementation: `async (path: string|Array<string>, options?: number|string)`
117
- + Usage example: `let [res, err] = await fs.mkdir('./my-new-folder');`
467
+ Removes (deletes) a file.
118
468
 
119
- - [fs.mkdtemp](https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options)
120
- + Typescript implementation: `async (prefix: string, encoding?: Encoding)`
121
- + Usage example: `let [res, err] = await fs.mkdtemp('temp-');`
469
+ Typescript implementation:
470
+ ```typescript
471
+ async (path: string|Array<string>)
472
+ ```
122
473
 
123
- - [fs.open](https://nodejs.org/api/fs.html#fspromisesopenpath-flags-mode)
124
- + Typescript implementation: `async (path: string|Array<string>, flags?: Flags, mode?: number|string)`
125
- + Usage example: `let [res, err] = await fs.open('file.txt', 'r');`
474
+ Usage example:
475
+ ```javascript
476
+ let [res, err] = await fs.unlink('file-symlink.txt');
477
+ ```
126
478
 
127
- - [fs.opendir](https://nodejs.org/api/fs.html#fspromisesopendirpath-options)
128
- + Typescript implementation: `async (path: string|Array<string>, flags?: Flags, mode?: number|string)`
129
- + Usage example: `let [res, err] = await fs.opendir('./test', { encoding: "utf8", bufferSize: 64 } );`
479
+ ---
130
480
 
131
- - [fs.readFile](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
132
- + Typescript implementation: `async (path: string|Array<string>, options?: Encoding)`
133
- + Usage example: `let [res, err] = await fs.readFile('file.txt', 'utf8');`
481
+ ### [fs.utimes](https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime)
134
482
 
135
- - [fs.readdir](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
136
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
137
- + Usage example: `let [res, err] = await fs.readdir('./my-directory');`
483
+ Changes the access and modification times of a file.
138
484
 
139
- - [fs.readlink](https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options)
140
- + Typescript implementation: `async (path: string|Array<string>, options?: object|string)`
141
- + Usage example: `let [res, err] = await fs.readlink('symlinkToFile.txt');`
485
+ Typescript implementation:
486
+ ```typescript
487
+ async (path: string|Array<string>, atime: number|string|Date, mtime: number|string|Date)
488
+ ```
142
489
 
143
- - [fs.realpath](https://nodejs.org/api/fs.html#fspromisesrealpathpath-options)
144
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
145
- + Usage example: `let [res, err] = await fs.realpath('./my-folder/../' );`
490
+ Usage example:
491
+ ```javascript
492
+ let [res, err] = await fs.utimes('file.txt', new Date(), new Date());
493
+ ```
146
494
 
147
- - [fs.rename](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
148
- + Typescript implementation: `async (oldPath: string|Array<string>, newPath: string|Array<string>)`
149
- + Usage example: `let [res, err] = await fs.rename('old.txt', 'new.txt' );`
495
+ ---
150
496
 
151
- - [fs.rm](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
152
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
153
- + Usage example: `let [res, err] = await fs.rm('file.txt' );`
497
+ ### [fs.watch](https://nodejs.org/api/fs.html#fspromiseswatchfilename-options)
154
498
 
155
- - [fs.rmdir](https://nodejs.org/api/fs.html#fspromisesrmdirpath-options)
156
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
157
- + Usage example: `let [res, err] = await fs.rmdir('./my-folder');`
499
+ Watches for changes in a file or directory and emits events.
158
500
 
159
- - [fs.stat](https://nodejs.org/api/fs.html#fspromisesstatpath-options)
160
- + Typescript implementation: `async (path: string|Array<string>, options?: object)`
161
- + Usage example: `let [res, err] = await fs.stat('file.txt');`
501
+ Typescript implementation:
502
+ ```typescript
503
+ async (filename: string|Array<string>, options?: BufferEncoding | "buffer")
504
+ ```
162
505
 
163
- - [fs.symlink](https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type)
164
- + Typescript implementation: `async (target: string|Array<string>, path: string|Array<string>, type?: string)`
165
- + Usage example: `let [res, err] = await fs.symlink('file.txt', 'file-symlink.txt', 'file');`
506
+ Usage example:
507
+ ```javascript
508
+ let [res, err] = await fs.watch('file.txt', (ev, file) => {
509
+ console.log("Watcher: " + file);
510
+ });
511
+ ```
166
512
 
167
- - [fs.truncate](https://nodejs.org/api/fs.html#fspromisestruncatepath-len)
168
- + Typescript implementation: `async (path: string|Array<string>, len:number)`
169
- + Usage example: `let [res, err] = await fs.truncate('file.txt', 760);`
513
+ ---
170
514
 
171
- - [fs.unlink](https://nodejs.org/api/fs.html#fspromisesunlinkpath)
172
- + Typescript implementation: `async (path: string|Array<string>)`
173
- + Usage example: `let [res, err] = await fs.unlink('file-symlink.txt');`
515
+ ### [fs.writeFile](https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options)
174
516
 
175
- - [fs.utimes](https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime)
176
- + Typescript implementation: `async (path: string|Array<string>, atime: number|string|Date, mtime: number|string|Date)`
177
- + Usage example: `let [res, err] = await fs.utimes('file.txt', new Date(), new Date());`
517
+ Writes data to a file, replacing its contents if it already exists.
178
518
 
179
- - [fs.watch](https://nodejs.org/api/fs.html#fspromiseswatchfilename-options)
180
- + Typescript implementation: `async (filename: string|Array<string>, options?: object|string)`
181
- + Usage example: `let [res, err] = await fs.watch('file.txt', (ev, file) => { console.log("Watcher: " + file); });`
519
+ Typescript implementation:
520
+ ```typescript
521
+ async (path: string|Array<string>, data: any, options?: Encoding)
522
+ ```
182
523
 
183
- - [fs.writeFile](https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options)
184
- + Typescript implementation: `async (path: string|Array<string>, data: any, options?: Encoding)`
185
- + Usage example: `let [res, err] = await fs.writeFile('file.txt', 'my text', 'utf8');`
524
+ Usage example:
525
+ ```javascript
526
+ let [res, err] = await fs.writeFile('file.txt', 'my text', 'utf8');
527
+ ```
186
528
 
529
+ ---
187
530
 
188
531
  ### The Constants
189
532
 
190
- - [fs.constants](https://nodejs.org/api/fs.html#fspromisesconstants)
191
- + The FS [constants](https://nodejs.org/api/fs.html#fs-constants) object
533
+ ### [fs.constants](https://nodejs.org/api/fs.html#fspromisesconstants)
534
+
535
+ The `fs.constants` object provides commonly used constants for file operations.
192
536
 
193
- - [fs.__dirname](https://nodejs.org/docs/latest/api/globals.html#__dirname)
194
- + The equivalent to node’s `__dirname` usable within ES6 Module Syntax. Returns the directory name of the current module.
195
- + Implementation: `path.dirname(fileURLToPath(import.meta.url));`
537
+ ---
196
538
 
197
- - [fs.__filename](https://nodejs.org/docs/latest/api/globals.html#__filename)
198
- + The equivalent to node’s `__filename` usable within ES6 Module Syntax. Returns the filename of the code which is executed.
199
- + Implementation: `fileURLToPath(import.meta.url);`
539
+ ### [fs.__dirname](https://nodejs.org/docs/latest/api/globals.html#__dirname)
540
+
541
+ Equivalent to Node’s `__dirname` but usable within ES modules. Returns the directory name of the current module.
542
+
543
+ Implementation:
544
+ ```javascript
545
+ path.dirname(fileURLToPath(import.meta.url));
546
+ ```
547
+
548
+ ---
549
+
550
+ ### [fs.__filename](https://nodejs.org/docs/latest/api/globals.html#__filename)
551
+
552
+ Equivalent to Node’s `__filename` but usable within ES modules. Returns the absolute filename of the current module.
553
+
554
+ Implementation:
555
+ ```javascript
556
+ fileURLToPath(import.meta.url);
557
+ ```
558
+
559
+ ---
200
560
 
201
561
 
202
562
  ### Bonus Functions
203
563
 
204
- - fs.exists
205
- + Checks if a file or directory exists, returns boolean
206
- + Typescript implementation: `async (path: string|Array<string>)`
207
- + Usage example: `let res = await fs.exists('file.txt');`
564
+ ---
208
565
 
209
- - fs.ensureDir
210
- + Checks if a directory exists, creates it if not
211
- + Typescript implementation: `async (dir: string|Array<string>)`
212
- + Usage example: `let res = await fs.ensureDir('./my-dir');`
566
+ ### fs.exists
567
+ Checks if a file or directory exists, returns boolean.
568
+ Typescript implementation:
569
+ ```typescript
570
+ async (path: string|Array<string>)
571
+ ```
572
+ Usage example:
573
+ ```javascript
574
+ let res = await fs.exists('file.txt');
575
+ ```
213
576
 
214
- - fs.readJson
215
- + Reads a JSON file and returns it as parsed Javascript object.
216
- + Typescript implementation: `async (path: string|Array<string>, options?: Encoding)`
217
- + Usage example: `let [res, err] = await fs.readJson('my.json');`
577
+ ---
218
578
 
219
- - fs.writeJson
220
- + Expects a Javascript object, will stringify it and write it out as JSON.
221
- + Typescript implementation: `async (path: string|Array<string>, data: Object, options?: Encoding)`
222
- + Usage example: `let [res, err] = await fs.writeJson('my.json', { key : "value" });`
579
+ ### fs.ensureDir
580
+ Checks if a directory exists, creates it if not.
581
+ Typescript implementation:
582
+ ```typescript
583
+ async (dir: string|Array<string>)
584
+ ```
585
+ Usage example:
586
+ ```javascript
587
+ let res = await fs.ensureDir('./my-dir');
588
+ ```
589
+
590
+ ---
591
+
592
+ ### fs.readJson
593
+ Reads a JSON file and returns it as parsed Javascript object.
594
+ Typescript implementation:
595
+ ```typescript
596
+ async (path: string|Array<string>, options?: Encoding)
597
+ ```
598
+ Usage example:
599
+ ```javascript
600
+ let [res, err] = await fs.readJson('my.json');
601
+ ```
602
+
603
+ ---
604
+
605
+ ### fs.writeJson
606
+ Expects a Javascript object, will stringify it and write it out as JSON.
607
+ Typescript implementation:
608
+ ```typescript
609
+ async (path: string|Array<string>, data: Object, options?: Encoding)
610
+ ```
611
+ Usage example:
612
+ ```javascript
613
+ let [res, err] = await fs.writeJson('my.json', { key : "value" });
614
+ ```
615
+
616
+ ---
223
617
 
224
- - fs.readTextFile
225
- + Reads a text file as UTF8
226
- + Typescript implementation: `async (path: string|Array<string>)`
227
- + Usage example: `let [res, err] = await fs.readTextFile('file.txt');`
618
+ ### fs.readTextFile
619
+ Reads a text file as UTF8.
620
+ Typescript implementation:
621
+ ```typescript
622
+ async (path: string|Array<string>)
623
+ ```
624
+ Usage example:
625
+ ```javascript
626
+ let [res, err] = await fs.readTextFile('file.txt');
627
+ ```
228
628
 
229
- - fs.writeTextFile
230
- + Writes out a String as UTF8
231
- + Typescript implementation: `async (path: string|Array<string>, data: string)`
232
- + Usage example: `let [res, err] = await fs.writeTextFile('file.txt', 'Hello world!');`
629
+ ---
630
+
631
+ ### fs.writeTextFile
632
+ Writes out a String as UTF8.
633
+ Typescript implementation:
634
+ ```typescript
635
+ async (path: string|Array<string>, data: string)
636
+ ```
637
+ Usage example:
638
+ ```javascript
639
+ let [res, err] = await fs.writeTextFile('file.txt', 'Hello world!');
640
+ ```
641
+
642
+ ---
233
643
 
234
644
  ### The Async Handler
235
645
 
236
646
  This Handler is behind all Async-file-tried functions. You can pass any function (wrapped in an anonymous function) to it,
237
647
  and the Result/ Error will be returned as tuple.
238
648
 
239
- - fs.asyncHandler
240
- + Takes any asynchronous Function and will internally wrap a try-catch block around it. The Return is given in the tuple pattern `[res, err]`.
241
- + Typescript implementation: `asyncHandler = async (func: Function)`
242
- + Usage example: `let [res, err] = await fs.asyncHandler(() => await myCustomFunction(someParam));`
649
+ ### fs.asyncHandler
650
+ Takes any asynchronous Function and will internally wrap a try-catch block around it. The Return is given in the tuple pattern `[res, err]`.
651
+ Typescript implementation:
652
+ ```typescript
653
+ asyncHandler = async (func: Function)
654
+ ```
655
+ Usage example:
656
+ ```javascript
657
+ let [res, err] = await fs.asyncHandler(() => await myCustomFunction(someParam));
658
+ ```
659
+ ---
660
+
661
+ ## Run tests
662
+
663
+ ```sh
664
+ npm test
665
+ ```
666
+
667
+ ## License
668
+
669
+ Copyright (c) 2023–25 Florian Walzel,
670
+ MIT License
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ declare const fs: {
37
37
  truncate: (path: string | Array<string>, len: number) => Promise<any[]>;
38
38
  unlink: (path: string | Array<string>) => Promise<any[]>;
39
39
  utimes: (path: string | Array<string>, atime: number | string | Date, mtime: number | string | Date) => Promise<any[]>;
40
- watch: (filename: string | Array<string>, options?: object | string) => Promise<any[]>;
40
+ watch: (filename: string | Array<string>, options?: BufferEncoding | "buffer") => Promise<any[]>;
41
41
  writeFile: (path: string | Array<string>, data: any, options?: Encoding) => Promise<any[]>;
42
42
  constants: typeof fsNormal.constants;
43
43
  __dirname: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) => {
367
367
  const pathResolved = __resolvePath(dir);
368
368
  let [acc, err] = await access(pathResolved);
369
- if (err)
370
- await mkdir(pathResolved, { recursive: true });
369
+ if (err) {
370
+ let [r, e] = await mkdir(pathResolved, { recursive: true });
371
+ if (e) {
372
+ console.error(e);
373
+ return false;
374
+ }
375
+ }
371
376
  return true;
372
377
  };
373
378
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;0CAE0C;AAE1C;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,QAA8B,EAAE,EAAE;IACvD,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;QACxB,CAAC,CAAC,QAAQ,CAAA;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,YAAY,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;IAC5C,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,IAAI,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAC;AAGF;;0CAE0C;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,GAAG,KAAK,EAAE,IAA0B,EAAE,IAAoB,EAAE,EAAE;IACxE,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,YAA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;AAYF,MAAM,EAAE,GAAG;IACT,MAAM;IACN,UAAU;IACV,KAAK;IACL,KAAK;IACL,QAAQ;IACR,EAAE;IACF,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;IACL,OAAO;IACP,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,EAAE;IACF,KAAK;IACL,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,KAAK;IACL,SAAS;IACT,SAAS;IACT,SAAS;IACT,UAAU;IACV,YAAY;IACZ,MAAM;IACN,SAAS;IACT,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,aAAa;CACd,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;IACjC,EAAE,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;AAEtC,eAAe,EAAE,CAAC"}
package/index.ts CHANGED
@@ -352,7 +352,7 @@ const utimes = async (path: string|Array<string>, atime: number|string|Date, mti
352
352
  * @param options
353
353
  * @returns {Promise<*[]>}
354
354
  */
355
- const watch = async (filename: string|Array<string>, options?: object|string) => {
355
+ const watch = async (filename: string|Array<string>, options?: BufferEncoding | "buffer") => {
356
356
  const filenameResolved = __resolvePath(filename);
357
357
  return await asyncHandler(() => fsp.watch(filenameResolved, options));
358
358
  };
@@ -411,8 +411,13 @@ const exists = async (path: string|Array<string>) => {
411
411
  const ensureDir = async (dir: string|Array<string>)=> {
412
412
  const pathResolved = __resolvePath(dir);
413
413
  let [acc, err] = await access(pathResolved);
414
- if (err)
415
- await mkdir(pathResolved, { recursive: true })
414
+ if (err) {
415
+ let [r,e] = await mkdir(pathResolved, { recursive: true })
416
+ if (e) {
417
+ console.error(e);
418
+ return false;
419
+ }
420
+ }
416
421
  return true;
417
422
  };
418
423
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "async-file-tried",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "A try-catch wrapper around node’s fs/promises.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "homepage": "https://github.com/fwalzel/async-file-tried#readme",
23
23
  "devDependencies": {
24
- "@types/node": "^20.9.5",
25
- "c8": "^8.0.1",
26
- "chai": "^4.3.6",
27
- "mocha": "^10.1.0",
28
- "typescript": "^5.7.2"
24
+ "@types/node": "^24.10.1",
25
+ "c8": "^10.1.3",
26
+ "chai": "^6.2.1",
27
+ "mocha": "^11.7.5",
28
+ "typescript": "^5.9.3"
29
29
  },
30
30
  "keywords": [
31
31
  "fs promises",
package/want.md DELETED
@@ -1,4 +0,0 @@
1
- - Logo (!)
2
- – bonus functions: file exists, ensureDir, writeTextFile, readTextFile
3
- - importable as common JS
4
- - README: how to use in typescript, explain asyncHandler