I am trying to create an array of specific files in a directory; which will go through a few test cases to make sure it fits a given criteria.
I'm using the fs.readdir
method, but it doesn't return a promise
meaning I cannot push
to an array
.
My idea was to populate an array (arr
) with the files I actually want to output and then do something with that array. But because readdir
is asynchronous and I can't chain a .then()
onto it, my plans are quashed.
I've also tried the same thing with readdirSync
to no avail.
via OmisNomis
No comments:
Post a Comment