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

How to Load Project Files into the Editor? #636

Open
aquino-luane opened this issue Sep 27, 2024 · 2 comments
Open

How to Load Project Files into the Editor? #636

aquino-luane opened this issue Sep 27, 2024 · 2 comments

Comments

@aquino-luane
Copy link

aquino-luane commented Sep 27, 2024

I have a .sb3 file that is returned from an API, and I want to load it into the editor when the app starts.

It seems that I need to set the project files into scratch-storage, but I am not sure if this is correct or how to do it.

Could someone please guide me on how to load the .sb3 file into the editor when the app starts?

Thank you!

@aquino-luane aquino-luane changed the title Help Needed for Loading .sb3 Project in Editor from API How to Load Project Files into the Editor? Sep 30, 2024
@mxmou
Copy link

mxmou commented Oct 4, 2024

Loading a project from a file can be done using the loadProject() method from scratch-vm, which accepts the contents of the file as an ArrayBuffer. See the implementation of the "Load from your computer" option: https://github.com/scratchfoundation/scratch-gui/blob/cb056c5/src/lib/sb-file-uploader-hoc.jsx#L145-L171

@aquino-luane
Copy link
Author

Loading a project from a file can be done using the loadProject() method from scratch-vm, which accepts the contents of the file as an ArrayBuffer. See the implementation of the "Load from your computer" option: https://github.com/scratchfoundation/scratch-gui/blob/cb056c5/src/lib/sb-file-uploader-hoc.jsx#L145-L171

I will check, thank you 🙏🏽

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