async-file-tried 1.2.0 → 1.2.2
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 +573 -138
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/index.ts +9 -3
- package/package.json +5 -5
- package/test/index.test.js +27 -9
- package/test/static-testfiles/file.txt +0 -0
- package/want.md +0 -4
package/README.md
CHANGED
|
@@ -9,10 +9,6 @@ Write more linear, better readable code by getting a concise response. Dependenc
|
|
|
9
9
|
[](https://coveralls.io/github/fwalzel/async-file-tried?branch=main)
|
|
10
10
|
[](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
|
|
|
@@ -52,184 +48,623 @@ catch (err) {
|
|
|
52
48
|
|
|
53
49
|
## Extra: joined paths
|
|
54
50
|
|
|
55
|
-
*async-file-tried* also has an in-built path.join() so that you can alternatively pass
|
|
51
|
+
*async-file-tried* also has an in-built `path.join()` so that you can alternatively pass the path argument as array of sub-elements.
|
|
56
52
|
|
|
57
53
|
You can write i.e.:
|
|
58
54
|
|
|
59
55
|
```javascript
|
|
60
|
-
let [res, err] = await fs.appendFile(
|
|
56
|
+
let [res, err] = await fs.appendFile(
|
|
57
|
+
['fs.__dirname', '..' , 'myfolder', `img_${i}.txt`],
|
|
58
|
+
'my text');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
... and the path string will be composed automatically.
|
|
62
|
+
|
|
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');
|
|
61
317
|
```
|
|
62
318
|
|
|
63
|
-
|
|
319
|
+
---
|
|
64
320
|
|
|
65
|
-
|
|
321
|
+
### [fs.readdir](https://nodejs.org/api/fs.html#filehandlereadfileoptions)
|
|
66
322
|
|
|
67
|
-
|
|
323
|
+
Reads the contents of a directory.
|
|
68
324
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
325
|
+
Typescript implementation:
|
|
326
|
+
```typescript
|
|
327
|
+
async (path: string|Array<string>, options?: object)
|
|
328
|
+
```
|
|
72
329
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
330
|
+
Usage example:
|
|
331
|
+
```javascript
|
|
332
|
+
let [res, err] = await fs.readdir('./my-directory');
|
|
333
|
+
```
|
|
76
334
|
|
|
77
|
-
|
|
78
|
-
+ Typescript implementation: `async (path: string|Array<string>, mode?: number|string)`
|
|
79
|
-
+ Usage example: `let [res, err] = await fs.chmod('file.txt', '755');`
|
|
335
|
+
---
|
|
80
336
|
|
|
81
|
-
|
|
82
|
-
+ Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
|
|
83
|
-
+ Usage example: `let [res, err] = await fs.chown('file.txt', 1541, 999);`
|
|
337
|
+
### [fs.readlink](https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options)
|
|
84
338
|
|
|
85
|
-
|
|
86
|
-
+ Typescript implementation: `async (srcPath: string|Array<string>, destPath: string|Array<string>,flags?: number)`
|
|
87
|
-
+ Usage example: `let [res, err] = await fs.copyFile('file.txt', 'file-copy.txt');`
|
|
339
|
+
Reads the value of a symbolic link.
|
|
88
340
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
341
|
+
Typescript implementation:
|
|
342
|
+
```typescript
|
|
343
|
+
async (path: string|Array<string>, options?: object|string)
|
|
344
|
+
```
|
|
92
345
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
346
|
+
Usage example:
|
|
347
|
+
```javascript
|
|
348
|
+
let [res, err] = await fs.readlink('symlinkToFile.txt');
|
|
349
|
+
```
|
|
96
350
|
|
|
97
|
-
|
|
98
|
-
+ Typescript implementation: `async (path: string|Array<string>, uid: number, gid: number)`
|
|
99
|
-
+ Usage example: `let [res, err] = await fs.lchown('./test/static-testfiles/symlinkToFile-append.txt', 1200, 1201);`
|
|
351
|
+
---
|
|
100
352
|
|
|
101
|
-
|
|
102
|
-
+ Typescript implementation: `async (existingPath: string|Array<string>, newPath: string|Array<string>)`
|
|
103
|
-
+ Usage example: `let [res, err] = await fs.link('file.txt', 'file-hard-link.txt');`
|
|
353
|
+
### [fs.realpath](https://nodejs.org/api/fs.html#fspromisesrealpathpath-options)
|
|
104
354
|
|
|
105
|
-
|
|
106
|
-
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
107
|
-
+ Usage example: `let [res, err] = await fs.lstat('symlinkToFile.txt');`
|
|
355
|
+
Resolves a path to its absolute real path, resolving symlinks.
|
|
108
356
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
357
|
+
Typescript implementation:
|
|
358
|
+
```typescript
|
|
359
|
+
async (path: string|Array<string>, options?: object)
|
|
360
|
+
```
|
|
112
361
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
362
|
+
Usage example:
|
|
363
|
+
```javascript
|
|
364
|
+
let [res, err] = await fs.realpath('./my-folder/../');
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### [fs.rename](https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath)
|
|
116
370
|
|
|
117
|
-
|
|
118
|
-
+ Typescript implementation: `async (prefix: string, encoding?: Encoding)`
|
|
119
|
-
+ Usage example: `let [res, err] = await fs.mkdtemp('temp-');`
|
|
371
|
+
Renames or moves a file or directory.
|
|
120
372
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
+
```
|
|
382
|
+
|
|
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
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### [fs.truncate](https://nodejs.org/api/fs.html#fspromisestruncatepath-len)
|
|
450
|
+
|
|
451
|
+
Truncates a file to a specified length.
|
|
452
|
+
|
|
453
|
+
Typescript implementation:
|
|
454
|
+
```typescript
|
|
455
|
+
async (path: string|Array<string>, len: number)
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Usage example:
|
|
459
|
+
```javascript
|
|
460
|
+
let [res, err] = await fs.truncate('file.txt', 760);
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
### [fs.unlink](https://nodejs.org/api/fs.html#fspromisesunlinkpath)
|
|
466
|
+
|
|
467
|
+
Removes (deletes) a file.
|
|
468
|
+
|
|
469
|
+
Typescript implementation:
|
|
470
|
+
```typescript
|
|
471
|
+
async (path: string|Array<string>)
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Usage example:
|
|
475
|
+
```javascript
|
|
476
|
+
let [res, err] = await fs.unlink('file-symlink.txt');
|
|
477
|
+
```
|
|
124
478
|
|
|
125
|
-
|
|
126
|
-
+ Typescript implementation: `async (path: string|Array<string>, flags?: Flags, mode?: number|string)`
|
|
127
|
-
+ Usage example: `let [res, err] = await fs.opendir('./test', { encoding: "utf8", bufferSize: 64 } );`
|
|
479
|
+
---
|
|
128
480
|
|
|
129
|
-
|
|
130
|
-
+ Typescript implementation: `async (path: string|Array<string>, options?: Encoding)`
|
|
131
|
-
+ Usage example: `let [res, err] = await fs.readFile('file.txt', 'utf8');`
|
|
481
|
+
### [fs.utimes](https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime)
|
|
132
482
|
|
|
133
|
-
|
|
134
|
-
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
135
|
-
+ Usage example: `let [res, err] = await fs.readdir('./my-directory');`
|
|
483
|
+
Changes the access and modification times of a file.
|
|
136
484
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
485
|
+
Typescript implementation:
|
|
486
|
+
```typescript
|
|
487
|
+
async (path: string|Array<string>, atime: number|string|Date, mtime: number|string|Date)
|
|
488
|
+
```
|
|
140
489
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
490
|
+
Usage example:
|
|
491
|
+
```javascript
|
|
492
|
+
let [res, err] = await fs.utimes('file.txt', new Date(), new Date());
|
|
493
|
+
```
|
|
144
494
|
|
|
145
|
-
|
|
146
|
-
+ Typescript implementation: `async (oldPath: string|Array<string>, newPath: string|Array<string>)`
|
|
147
|
-
+ Usage example: `let [res, err] = await fs.rename('old.txt', 'new.txt' );`
|
|
495
|
+
---
|
|
148
496
|
|
|
149
|
-
|
|
150
|
-
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
151
|
-
+ Usage example: `let [res, err] = await fs.rm('file.txt' );`
|
|
497
|
+
### [fs.watch](https://nodejs.org/api/fs.html#fspromiseswatchfilename-options)
|
|
152
498
|
|
|
153
|
-
|
|
154
|
-
+ Typescript implementation: `async (path: string|Array<string>, options?: object)`
|
|
155
|
-
+ Usage example: `let [res, err] = await fs.rmdir('./my-folder');`
|
|
499
|
+
Watches for changes in a file or directory and emits events.
|
|
156
500
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
501
|
+
Typescript implementation:
|
|
502
|
+
```typescript
|
|
503
|
+
async (filename: string|Array<string>, options?: BufferEncoding | "buffer")
|
|
504
|
+
```
|
|
160
505
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
506
|
+
Usage example:
|
|
507
|
+
```javascript
|
|
508
|
+
let [res, err] = await fs.watch('file.txt', (ev, file) => {
|
|
509
|
+
console.log("Watcher: " + file);
|
|
510
|
+
});
|
|
511
|
+
```
|
|
164
512
|
|
|
165
|
-
|
|
166
|
-
+ Typescript implementation: `async (path: string|Array<string>, len:number)`
|
|
167
|
-
+ Usage example: `let [res, err] = await fs.truncate('file.txt', 760);`
|
|
513
|
+
---
|
|
168
514
|
|
|
169
|
-
|
|
170
|
-
+ Typescript implementation: `async (path: string|Array<string>)`
|
|
171
|
-
+ Usage example: `let [res, err] = await fs.unlink('file-symlink.txt');`
|
|
515
|
+
### [fs.writeFile](https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options)
|
|
172
516
|
|
|
173
|
-
|
|
174
|
-
+ Typescript implementation: `async (path: string|Array<string>, atime: number|string|Date, mtime: number|string|Date)`
|
|
175
|
-
+ 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.
|
|
176
518
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
519
|
+
Typescript implementation:
|
|
520
|
+
```typescript
|
|
521
|
+
async (path: string|Array<string>, data: any, options?: Encoding)
|
|
522
|
+
```
|
|
180
523
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
524
|
+
Usage example:
|
|
525
|
+
```javascript
|
|
526
|
+
let [res, err] = await fs.writeFile('file.txt', 'my text', 'utf8');
|
|
527
|
+
```
|
|
184
528
|
|
|
529
|
+
---
|
|
185
530
|
|
|
186
531
|
### The Constants
|
|
187
532
|
|
|
188
|
-
|
|
189
|
-
+ The FS [constants](https://nodejs.org/api/fs.html#fs-constants) object
|
|
533
|
+
### [fs.constants](https://nodejs.org/api/fs.html#fspromisesconstants)
|
|
190
534
|
|
|
191
|
-
|
|
192
|
-
+ The equivalent to node’s `__dirname` usable within ES6 Module Syntax. Returns the directory name of the current module.
|
|
193
|
-
+ Implementation: `path.dirname(fileURLToPath(import.meta.url));`
|
|
535
|
+
The `fs.constants` object provides commonly used constants for file operations.
|
|
194
536
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
537
|
+
---
|
|
538
|
+
|
|
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
|
+
---
|
|
198
560
|
|
|
199
561
|
|
|
200
562
|
### Bonus Functions
|
|
201
563
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
564
|
+
---
|
|
565
|
+
|
|
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
|
+
```
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
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
|
+
---
|
|
617
|
+
|
|
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
|
+
```
|
|
628
|
+
|
|
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
|
+
---
|
|
643
|
+
|
|
644
|
+
### The Async Handler
|
|
645
|
+
|
|
646
|
+
This Handler is behind all Async-file-tried functions. You can pass any function (wrapped in an anonymous function) to it,
|
|
647
|
+
and the Result/ Error will be returned as tuple.
|
|
648
|
+
|
|
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,14 +37,14 @@ 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?:
|
|
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: string;
|
|
44
44
|
__filename: string;
|
|
45
45
|
asyncHandler: (func: Function) => Promise<any[]>;
|
|
46
46
|
exists: (path: string | Array<string>) => Promise<boolean>;
|
|
47
|
-
ensureDir: (dir: string | Array<string>) => Promise<
|
|
47
|
+
ensureDir: (dir: string | Array<string>) => Promise<boolean>;
|
|
48
48
|
readJson: (path: string | Array<string>, options?: Encoding) => Promise<any[]>;
|
|
49
49
|
writeJson: (path: string | Array<string>, data: Object, options?: Encoding) => Promise<any[]>;
|
|
50
50
|
readTextFile: (path: string | Array<string>) => Promise<any[]>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAmdpC;;0CAE0C;AAE1C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAC,QAAQ,GAAC,QAAQ,GAAC,KAAK,GAAC,MAAM,GAAC,SAAS,GAAC,MAAM,CAAC;AAC/E,MAAM,MAAM,KAAK,GAAG,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,GAAC,GAAG,GAAC,IAAI,GAAC,IAAI,GAAC,KAAK,CAAC;AAEhF,QAAA,MAAM,EAAE;mBAhboB,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM,GAAC,MAAM;uBAYtC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,YAAY;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAC;KAAE;kBAW5G,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM,GAAC,MAAM;kBAY1C,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,OAAO,MAAM,OAAO,MAAM;wBAYxC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,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AK,CAAC,MAAM,CAAC,YAAY,MAAM;sBAajC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM;qBAYhE,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,OAAM,MAAM;mBAUlC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;mBAYpB,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM,GAAC,MAAM,GAAC,IAAI,SAAS,MAAM,GAAC,MAAM,GAAC,IAAI;sBAWvE,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,YAAY,cAAc,GAAG,QAAQ;sBAYzD,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,YAAY,QAAQ;;;;yBApVhD,QAAQ;mBAsXd,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;qBAUlB,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;qBAmBpB,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,YAAY,QAAQ;sBAevC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,MAAM,YAAY,QAAQ;yBASnD,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;0BAUnB,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,MAAM;CAuDpE,CAAC;AAKF,eAAe,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -366,8 +366,14 @@ const exists = async (path) => {
|
|
|
366
366
|
const ensureDir = async (dir) => {
|
|
367
367
|
const pathResolved = __resolvePath(dir);
|
|
368
368
|
let [acc, err] = await access(pathResolved);
|
|
369
|
-
if (err)
|
|
370
|
-
|
|
369
|
+
if (err) {
|
|
370
|
+
let [r, e] = await mkdir(pathResolved, { recursive: true });
|
|
371
|
+
if (e) {
|
|
372
|
+
console.error(e);
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return true;
|
|
371
377
|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,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?:
|
|
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,14 @@ 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
|
-
|
|
414
|
+
if (err) {
|
|
415
|
+
let [r,e] = await mkdir(pathResolved, { recursive: true })
|
|
416
|
+
if (e) {
|
|
417
|
+
console.error(e);
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return true;
|
|
416
422
|
};
|
|
417
423
|
|
|
418
424
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "async-file-tried",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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": "^
|
|
24
|
+
"@types/node": "^24.5.2",
|
|
25
25
|
"c8": "^8.0.1",
|
|
26
|
-
"chai": "^
|
|
27
|
-
"mocha": "^
|
|
28
|
-
"typescript": "^5.
|
|
26
|
+
"chai": "^6.0.1",
|
|
27
|
+
"mocha": "^11.7.2",
|
|
28
|
+
"typescript": "^5.9.2"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"fs promises",
|
package/test/index.test.js
CHANGED
|
@@ -369,35 +369,53 @@ describe('Tests for async-file-tried', () => {
|
|
|
369
369
|
assert.equal(res, false);
|
|
370
370
|
});
|
|
371
371
|
|
|
372
|
-
it('[63]
|
|
372
|
+
it('[63] RES: fs.exists shall return TRUE file exists', async () => {
|
|
373
373
|
let res = await fs.exists('./test/static-testfiles/file.txt');
|
|
374
374
|
assert.equal(res, true);
|
|
375
375
|
});
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
|
|
378
|
+
it('[64] RES: fs.exists shall return TRUE if folder exists', async () => {
|
|
379
|
+
let res = await fs.ensureDir('./test/static-testfiles');
|
|
380
|
+
assert.equal(res, true);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it('[65] RES: fs.exists shall return TRUE if folder was created', async () => {
|
|
384
|
+
let res = await fs.ensureDir('./test/static-testfiles/ensure-folder');
|
|
385
|
+
assert.equal(res, true);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('[66] ERR: fs.writeJson shall error when file does not exist', async () => {
|
|
378
389
|
let [res, err] = await fs.writeJson('', '');
|
|
379
390
|
assert.notEqual(err, null);
|
|
380
391
|
});
|
|
381
392
|
|
|
382
|
-
it('[
|
|
393
|
+
it('[67] RES: fs.writeJson shall return valid result when JSON was written', async () => {
|
|
383
394
|
let [res, err] = await fs.writeJson('./test/static-testfiles/test.json', { key : "value" });
|
|
384
395
|
assert.equal(err, null);
|
|
385
396
|
});
|
|
386
397
|
|
|
387
|
-
it('[
|
|
398
|
+
it('[68] ERR: fs.readJson shall error when file does not exist', async () => {
|
|
388
399
|
let [res, err] = await fs.readJson('');
|
|
389
400
|
assert.notEqual(err, null);
|
|
390
401
|
});
|
|
391
402
|
|
|
392
|
-
it('[
|
|
403
|
+
it('[69] RES: fs.readJson shall return object when JSON was read', async () => {
|
|
393
404
|
let [res, err] = await fs.readJson('./test/static-testfiles/test.json', 'utf8');
|
|
394
405
|
assert.isObject(res);
|
|
395
406
|
});
|
|
396
407
|
|
|
408
|
+
it('Cleanup', async () => {
|
|
409
|
+
// cleanup symlink from test run:
|
|
410
|
+
await fs.unlink('./test/static-testfiles/symlinkToFile-append.txt');
|
|
411
|
+
|
|
412
|
+
// cleanup symlink from test run:
|
|
413
|
+
await fs.rm('./test/static-testfiles/file.txt');
|
|
414
|
+
|
|
415
|
+
// cleanup symlink from test run:
|
|
416
|
+
await fs.rmdir('./test/static-testfiles/ensure-folder');
|
|
417
|
+
});
|
|
418
|
+
|
|
397
419
|
});
|
|
398
420
|
|
|
399
|
-
// cleanup symlink from test run:
|
|
400
|
-
await fs.unlink('./test/static-testfiles/symlinkToFile-append.txt');
|
|
401
421
|
|
|
402
|
-
// cleanup symlink from test run:
|
|
403
|
-
await fs.rm('./test/static-testfiles/file.txt');
|
|
File without changes
|
package/want.md
DELETED