Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a listDirs method that lists folders in a given directory. #37

Closed
mhkeller opened this issue Oct 26, 2015 · 1 comment
Closed

Add a listDirs method that lists folders in a given directory. #37

mhkeller opened this issue Oct 26, 2015 · 1 comment

Comments

@mhkeller
Copy link
Owner

From kestrel-cli: ajam/kestrel-cli@221a7b0

Also supports optional hidden dirs

function getDirectories(srcpath, opts) {
  return fs.readdirSync(srcpath).filter(function(file) {
    var is_directory = fs.statSync(path.join(srcpath, file)).isDirectory()
    // Test for folders that start with a dot
    if (is_directory && opts && opts.excludeHidden) {
      is_directory = !/^\./.test(file)
    }
    return is_directory;
  });
}
@mhkeller
Copy link
Owner Author

This has been implemented as flags on readdirFilter in 1.0.0. See changelog for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant