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

atime, birthtime, mtime, and ctime are always undefined in ignore.ignored function. #604

Open
f3ve opened this issue Aug 7, 2024 · 1 comment

Comments

@f3ve
Copy link

f3ve commented Aug 7, 2024

I'm trying to filter results depending on when they were created similar to the example provided in the README but so far all of the various time values seem to be always be undefined despite setting stat: true and withFileTypes: true. Am I missing something or is this a bug?

Here is a snippet of my code:

const paths = await glob(GLOB, {
  root: dir,
  nodir: true,
  stat: true,
  withFileTypes: true,
  ignore: {
    ignored: (p) => {
      console.log(p.atime, p.birthtime, p.mtime, p.ctime); // output: undefined undefined undefined undefined
      const isValid = ALL || (!!p.birthtime && p.birthtime > past);
      return !isValid;
    },
  },
});
@f3ve
Copy link
Author

f3ve commented Aug 7, 2024

Actually, it seems that p.birthtime is also undefined outside of the ignore.ignored function:

console.log('Getting files...');
const paths = await glob(GLOB, {
  root: dir,
  nodir: true,
  stat: true,
  withFileTypes: true,
});

console.log('Filtering files...');
const filteredPaths = paths.filter((p) => {
  // p.birthtime is also undefined here.
  ALL || (!!p.birthtime && p.birthtime > past);
});

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

1 participant