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

Multiple calls to readdirSync adds to the returned array #25

Open
stubar opened this issue Mar 6, 2018 · 5 comments
Open

Multiple calls to readdirSync adds to the returned array #25

stubar opened this issue Mar 6, 2018 · 5 comments

Comments

@stubar
Copy link

stubar commented Mar 6, 2018

If I call globFs.readdirSync(path, {cwd: '/'}) multiple times I get a different array each time. The file list is being added to the last response each time.

Note I'm using the cwd param because I'm passing in absolute paths.

@laseryuan
Copy link

Same issue for not specifying options.

@mntmn
Copy link

mntmn commented Apr 16, 2018

Ran into the same issue which caused a security problem (files returned that should not have been).

@mistic100
Copy link

Encountered this problem as well, unfortunately I had to switch to https://github.com/isaacs/node-glob

@ferdinandyb
Copy link

@marrowleaves
Copy link

A workaround is to create a new instance of the Glob object each time you match a pattern, like:

const glob = require('glob-fs')
glob().use(..).readdir(..)

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

No branches or pull requests

6 participants