paulmillr / readdirp

Recursive version of fs.readdir with streaming api.
https://paulmillr.com
MIT License
378 stars 51 forks source link

stream.destroy not working #103

Closed sudhakar3697 closed 4 years ago

sudhakar3697 commented 5 years ago

I want to check if a directory has at least a sub-directory.

const stream=readdirp(dir, {depth:1,type:'directories', alwaysStat: false})
  .on('data', (entry) => {
    if(entry.dirent.isDirectory()){
    console.log(dir+" has SubDir");
   stream.destroy();
    }
  })

Thank you.

paulmillr commented 5 years ago

It’s destroy(), not destoy().

sudhakar3697 commented 5 years ago

@paulmillr Sorry for the typo. I tried with destroy only.

paulmillr commented 4 years ago

should have been fixed with 3.2