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

Feature request: noatime to prevent atime being updated on file access #368

Closed
bentorkington opened this issue Oct 4, 2022 · 2 comments
Closed

Comments

@bentorkington
Copy link

Background: in normal use, even when one only reads from a filesystem, there is still one property that is modified: the atime property of files and directories. This of course is not the case when a filesystem is mounted read-only, or mounted with the noatime option on Linux.

Because one might use mock-fs to test a tool depends on all properties of items remaining stable (e.g. something that creates a tarball) it would be useful to emulate this noatime behaviour so that subsequent accesses produce exactly the same results.

Could this be achieved by an option that replaces Item.setATime() with a no-op?

@3cp
Copy link
Collaborator

3cp commented Oct 4, 2022

You don't need mock-fs to add a feature.

JS allows you to monkey patch.

const Item = require('mock-fs/lib/item.js');
Item.prototype.setATime = function () {};

The noatime feature is probably little bit out of scope for mock-fs, as there are quite a few others options like nobrowse, rw, ro, nosuid, nodev, ...

@bentorkington
Copy link
Author

JS allows you to monkey patch.

thanks, you're right, it's so easy to monkey-patch this that there's no need to add complication to mock-fs

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

2 participants