manidlou / node-klaw-sync

Node.js recursive synchronous fast file system walker
MIT License
157 stars 10 forks source link

noDir is not working #19

Closed nareshbhatia closed 2 years ago

nareshbhatia commented 2 years ago

I am using version 6.0.0 and it seems that noDir is not working.

const path = require('path');
const klawSync = require('klaw-sync');

const tmplDir = path.join(__dirname, 'generators/react/app/templates/');

// get all templates (no directories)
const templates = klawSync(tmplDir, { noDir: true });

templates.forEach((template) => {
  const tmplPath = template.path;
  console.log(template.stats.isFile() ? 'f' : 'd', tmplPath);
});

Output shows both files and directories. Am I doing something wrong?

nareshbhatia commented 2 years ago

Sorry, my bad. I had the option spelled as noDir. It should have been nodir.