-
Notifications
You must be signed in to change notification settings - Fork 68
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
Mounting with non-standard metadata URL does not work / Mounting with Blob
objects from main JS thread does not work
#486
Comments
Also Why there is no metadata path in |
Hi, Yes, webR derives the metadata URL from the data URL. This is why you cannot use your Zenodo URLs, they end in Even with the above, your other method should work - but it looks like there's currently a bug related to how If it is urgent, you can work around the bug by doing the work synchronously on the webR worker thread, avoiding the problem with transferring the dir.create("/home/web_user/rave_data")
webr::eval_js('
const path = "/home/web_user/rave_data";
const data = "https://zenodo.org/api/records/13825852/files/project-demo-minimal.data/content";
const meta = "https://zenodo.org/api/records/13825852/files/project-demo-minimal.js.metadata/content";
const data_req = new XMLHttpRequest();
data_req.responseType = "arraybuffer"
data_req.open("GET", data, false);
data_req.send(null);
const _data = data_req.response
const meta_req = new XMLHttpRequest();
meta_req.responseType = "json"
meta_req.open("GET", meta, false);
meta_req.send(null);
const _meta = meta_req.response
const options = {
packages: [{
blob: new Blob([_data]),
metadata: _meta,
}],
}
Module.FS.mount(Module.FS.filesystems.WORKERFS, options, path)
')
readLines('~/rave_data/raw_dir/DemoSubject/rave-imaging/fs/mri/transforms/talairach.xfm') |
Thanks for checking it. Now I see what's going on... So blobs are converted to typed array when transferred to workers... No wonder when I console.log options, the blob is typed arrays. Currently my workaround is to manually slice the data manually and use I do have a wishlist to convert |
Yes, we are forced to make the conversion for annoying but unrelated technical reasons. In the future when we're able to work around the issue we'll be able to return to transferring
This should work, but it's not been tested heavily. If you do investigate this method don't forget to run
I did notice that your data was not being cached by my browser when I was testing. How much control do you have over the content HTTP headers? If you can configure Zenodo to send the content with HTTP header |
Blob
objects from main JS thread does not work
Or
Thanks I will try it.
I don't have controls over Zenodo. I guess I'll try the cache by myself for now. Good to know that you can set cache controls. Then this is an edge case and won't appear too often in the future : ) |
Dear webr devs,
I generated my dataset using rwasm::file_packager. However, when I try to load it directly from JS, the browser complains
To replicate, you can download the data from here: https://zenodo.org/records/13825852
When loading from
webr::mount
locally, everything is fine.This is a screenshot of results with
webr::mount
: it can read the files correctly:However, when I try to deploy the website and use the URL
(For you to test the URL, I'm using the zenodo API with CORS. Just FYI the URL has no issue. The error exists when testing it locally too)
Error:
Browser: Firefox 130.0.1 (64-bit)
OS: Apple M2 Sequoia
WebR: 0.4.2
rwasm: 0.2.0.9000
The text was updated successfully, but these errors were encountered: