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 readonly flag to Files #35

Merged
merged 3 commits into from
Jul 2, 2023
Merged

Add readonly flag to Files #35

merged 3 commits into from
Jul 2, 2023

Conversation

ansemjo
Copy link
Contributor

@ansemjo ansemjo commented Jul 1, 2023

This PR adds an options?: FileOptions argument to File and SyncOPFSFile, where the only known option so far is a readonly boolean. This is then handled in truncate(), fd_write() and path_open().

A usage example might be safely sharing a data file amongst multiple instances—or even Workers—by backing a File with a SharedArrayBuffer and marking it "readonly".

to safely use file backed by SharedArrayBuffer among multiple instances
src/fs_core.ts Show resolved Hide resolved
src/fs_fd.ts Outdated Show resolved Hide resolved
@bjorn3 bjorn3 merged commit db998fe into bjorn3:main Jul 2, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants