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

Accessing last modified time for directory handles #253

Closed
TheCymaera opened this issue Dec 7, 2020 · 2 comments
Closed

Accessing last modified time for directory handles #253

TheCymaera opened this issue Dec 7, 2020 · 2 comments

Comments

@TheCymaera
Copy link

TheCymaera commented Dec 7, 2020

For file handles, we can get the last modified time by calling FileSystemFileHandle.getFile().lastModifiedTime. This is not currently possible for directories.

A potential solution would be the addition of a stat() method for both file and directories handles. This would be helpful for multi-file editors like IDEs, which need to poll for changes. For example:

let oldTime = await dirHandle.stats().lastModifiedTime;
setInterval(async ()=>{
	const stats = await dirHandle.stats();

	if (oldTime < stats.lastModifiedTime) {
		oldTime = stats.lastModifiedTime;

		// infer changes and do stuff...
	}
},1000);
@mkruisselbrink
Copy link
Contributor

Also related to #101 and #215, I agree that this is something we probable want.

@a-sully
Copy link
Collaborator

a-sully commented Jan 9, 2023

#101 has since been ported to whatwg/fs#12. Closing this issue in favor of that one

@a-sully a-sully closed this as completed Jan 9, 2023
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

3 participants