Open akaRem opened 8 years ago
I'm having the same problem. This was driving me nuts for few days.
This will output all json
files:
var res = glob.readdirSync('/**/*.json')
console.log('res = ' + res)
This will not filter all json
files, but everything instead:
glob.readdirPromise('**/*.json')
.then(function (file) {
console.log(file)
})
My current plan is to switch to other libraries that actually can filter out files by extension.
@revelt @akaRem, yea, well-known bug (or at least) for me from the very beginning of the refactor with these iterators. At all, glob-fs
is not fully ready and is experimental.
@tunnckoCore I see! What library do you prefer for promises+glob file reads?
unfortunately... there is no other package in the whole community that do globs... evey is based on glob, which is very sad and i hate that fact. but it will be changed this year - i made couple of streaming implementation that performs 100-200x better and faster, passing 90% of glob-stream tests. but anyway.
the only thing is custom promise wrapper over glob, or globby directly
Hm. With regards to glob-fs
, should we, in theory, add a proper test suite to show where exactly it fails its promises (pun intended)? In my understanding the test suite is not complete according to what's said in readme... Although I don't see Travis set up either..
When I try this
I see just just all files in dir
I suppose that error is somewhere here:
because it's strange to me that
end
is emitted before promise is resolved.but change from this:
to this:
didn't help
Did I used this method properly? Or am I missing somethig? Or is there some error?