@kenjura/ursa 0.7.0 → 0.8.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.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/helper/recursive-readdir.js +9 -7
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { resolve } from
|
|
2
|
-
import { readdir } from
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { readdir } from "fs/promises";
|
|
3
3
|
|
|
4
4
|
export async function recurse(dir) {
|
|
5
5
|
const dirents = await readdir(dir, { withFileTypes: true });
|
|
6
|
-
const files = await Promise.all(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const files = await Promise.all(
|
|
7
|
+
dirents.map(async (dirent) => {
|
|
8
|
+
const res = resolve(dir, dirent.name);
|
|
9
|
+
return dirent.isDirectory() ? [res, ...(await recurse(res))] : res;
|
|
10
|
+
})
|
|
11
|
+
);
|
|
10
12
|
return Array.prototype.concat(...files);
|
|
11
|
-
}
|
|
13
|
+
}
|