You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deserialize a file/directory tree into an object. Particularly useful for testing where you need to do a `deepStrictEqual()` on a simple tree of files. **See [mkfiletree](https://github.com/rvagg/node-mkfiletree) for file tree serialization.**
6
6
7
-
Particularly useful for testing where you need to do a `deepStrictEqual()` on a simple tree of files. **See [mkfiletree](https://github.com/rvagg/mkfiletree) for file tree serialisation.**
7
+
## Requirements
8
8
9
-
### async readfiletree(directory)
9
+
Node.js >= 20
10
+
11
+
## API
12
+
13
+
### await readfiletree(directory)
10
14
11
15
Read the directory and the files it contains, recursively, and return an object representing the directory structure with nodes containing the utf8 string contents of each file.
12
16
@@ -36,19 +40,19 @@ The directory structure created above looks like the following:
36
40
37
41
```
38
42
$ find /tmp/testfiles11240-23530-r7rs3 -type f -exec sh -c "echo '\n{}: ' && cat '{}'" \;
Permission is hereby granted, free of charge, to any person obtaining a copy
75
-
of this software and associated documentation files (the "Software"), to deal
76
-
in the Software without restriction, including without limitation the rights
77
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
78
-
copies of the Software, and to permit persons to whom the Software is furnished
79
-
to do so, subject to the following conditions:
80
-
81
-
The above copyright notice and this permission notice shall be included in all
82
-
copies or substantial portions of the Software.
74
+
## License
83
75
84
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
85
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
86
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
87
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
88
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
90
-
SOFTWARE.
76
+
**readfiletree** is Copyright (c) 2012 Rod Vagg [@rvagg](https://github.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
0 commit comments