Last active
August 15, 2021 18:01
-
-
Save NathanLeadill/551e3d2de5e3452a1e91f53ef41d4a05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* getFiles(dir) { | |
const dirEntries = await readdir(dir, { withFileTypes: true }); | |
for (const dirEntry of dirEntries) { | |
const res = resolve(dir, dirEntry.name); | |
if (dirEntry.isDirectory()) { | |
yield* getFiles(res); | |
} else { | |
yield res; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment