Skip to content

readdirAsync doesn't filter #13

@akaRem

Description

@akaRem

When I try this

require('glob-fs')().readdirPromise('**/*.yaml').then((_)=>console.log(_))

I see just just all files in dir

I suppose that error is somewhere here:

    readdirPromise: function(pattern, options) {
      this.emit('read');
      this.setPattern(pattern, options);
      var res = this.iteratorPromise(this.pattern.base);  
      this.emit('end', this.files);
      return res;
    }

because it's strange to me that end is emitted before promise is resolved.

but change from this:

      this.emit('end', this.files);

to this:

      res.then(() => this.emit('end', this.files));

didn't help

Did I used this method properly? Or am I missing somethig? Or is there some error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions