The nodejs
fs
module has a delapidated syntax, and is generally just a pain to use.
There is a much better solution available now.
https://github.com/ablipan/fs-jetpack
The library makes the filesystem a breeze to work with, just look:
const path = '~/Downloads'
const directoryItems = await jetpack.inspectTreeAsync(path)
That will give you a structured list of all files in a directory recursively with additional attributes (like filesize) and other metadata.
I love it!