Ideas for automatically fetching files on the web
See original GitHub issueThanks to Pyxel’s new utility script, an html file for Pyxel is very simplified like this.
Another thing I would like to achieve is automatic fetching of files. It seems that Emscripten can’t mount real file system directly, but it may be realized virtually if I can insert some hook script for each load function in Pyxel.
With the feature, I would like shorten this script from
<body>
<div id="loading">Loading...</div>
<pyxel-asset name="assets/pyxel_logo_38x16.png"></pyxel-asset>
<pyxel-run root="../../python/pyxel/examples" name="01_hello_pyxel.py"
onstart="document.getElementById('loading').remove()"></pyxel-run>
</body>
to
<body>
<div id="loading">Loading...</div>
<pyxel-run root="../../python/pyxel/examples" name="01_hello_pyxel.py"
onstart="document.getElementById('loading').remove()"></pyxel-run>
</body>
If anyone has the knowledge to implement this feature, I would appreciate any advice.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Fetching data from the server - Learn web development | MDN
This article shows how to start working with Fetch to fetch data from the server.
Read more >Web Publishing with Fetch - Fetch Softworks
Fetch will automatically pick the correct format, quickly upload entire folders, and detect stalls and network or server errors and automatically resume uploads ......
Read more >Import data from the web - Microsoft Support
On the Import Data from Web worksheet, copy the URL, which is a Wikipedia page for the FIFA World Cup standings. Select Data...
Read more >8 Surprising Ways You Can Import Data Into Microsoft Word
1. Import a Table From Microsoft Excel · 2. Import a Single Cell From Microsoft Excel · 3. Import a Graph or Chart...
Read more >Dropbox.com
Dropbox brings everything—traditional files, cloud content, and web shortcuts—together in one place. Get 2 GB of cloud storage for free with Dropbox Basic....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for your comment.
I just searched for synchronous XMLHTTPRequest sample code which works, and copied it. https://github.com/kitao/pyxel/blob/main/wasm/pyxel.js#L292-L299
Regarding file system side, when I tried whether I can replace functions under pyodide.FS, it worked. So I wrapped open and stat functions to invoke XMLHTTPRequest when called. https://github.com/kitao/pyxel/blob/main/wasm/pyxel.js#L319-L330
Best, Takashi Kitao.
2022年10月6日(木) 17:34 Minsoo @.***>:
In 1.8.12. I added a hook function for Emscripten file system so that Pyxel can get necessary files automatically.