-
Notifications
You must be signed in to change notification settings - Fork 9
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
Writing binary files #1171
Open
loiswells97
wants to merge
36
commits into
main
Choose a base branch
from
spike-writing-binary-files
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Writing binary files #1171
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ting pyodide filesystem straightaway
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, the batching means that when an image is created, the main thread interprets that as separate images and creates a bunch of invalid files with the same name. To stop this happening, we probably need to modify the response on the frontend to ensure that the batched writes all hit the same file and append to rather than overwrite the existing content. The question we will have is when do we want existing files to be overwritten and when do we want them to be appended to and how can we tell? For example, if it's another batch of binary from the same request then we might want it to append, whereas if it's another request from the user, we might want it to overwrite. Maybe we need some metadata to give a unique ID to the request?
Question: How do we want to deal with image files created by a user who is not logged in? Do we want to let them save the image to the bucket anyway? Or should it be saved in localStorage somehow? An MVP option could be to tell them they have to log in to add images to the project, although not ideal.
Also, we may need some changes on the API side to stop writing to a filename that already exists creating multiple files with the same name in the same project. Can we have an update image endpoint as well as a create image endpoint? And if so, would we overwrite the original image in the bucket? In other words, how would this work in practice?
Work out why updating an image only works after the page has been reloaded, otherwise it creates a second image with the same name.