You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently trying out self-hosting webR on local server on mobile device (iOS iPad).
Downloaded releases version of webR and hosting on iOS iPad local server app by then opening webr-0.4.0 folder on the local server and pointing the server to index.html. WebR works great by that process and am able to install and use packages from the webR repository.
However, as per many other requests that have been posted, I'm interested in having my most commonly used R packages persist on my device instead of needing to download every time I open up my local server and browser and am more limited by mobile device sandboxing. I noticed that the webr-0.4.0 release that I downloaded includes a library folder:
webr-0.4.0/vfs/usr/lib/R/library
with what appeared to be the webR libraries that are standardly loaded when webR starts, and I presumed that webR loaded its libraries into the virtual FS by loading the libraries in the above folder. If so, I figured I could just download additional webR packaged libraries and add them to the above library folder and then webR would load with the additional packages preconfigured when I start webR. However, that doesn't occur-- despite having a webR package in the above folder on my local server (e.g. cli) it doesn't show up in the virtual FS for me to use when I start webR.
What then are the packages in the above library of the release version of webR for self-hosting used for? Would it be possible to point webR to that folder so that I can add additional libraries to it that would be automatically mounted to the VFS when webR loads on my local hosted server?
thanks!
The text was updated successfully, but these errors were encountered:
Adding to this directory unfortunately won't work, because webR is configured at compile time to load the package files there. It is possible to expand the library, but it requires building webR from scratch.
You may have already noticed that a webR VFS image consists of two files, a .js.metadata file and a .data file. For example, for the {cli} package the VFS image files can be downloaded from the public webR repo:
Now, in webR you should be able to mount your packages by creating a new package library, and mounting each package in the VFS. You can run this R script at startup to prepare your filesystem for use1.
# Create package library
dir.create("/packages")
.libPaths(c("/packages", .libPaths()))
# Mount each package
dir.create("/packages/cli")
webr::mount("/packages/cli", "./packages/cli_3.6.3.data")
Finally, once that's done you should be able to load your package without downloading from the public webR package repo.
# Load your package(s)
library(cli)
Footnotes
Probably this script can be easily expanded to first download a file containing a list of available package URLs, such as a MANIFEST file, then loop through the URLs mounting each one. It's also possible to create a single VFS image for a collection of packages using the {rwasm} R package. ↩
Recently trying out self-hosting webR on local server on mobile device (iOS iPad).
Downloaded releases version of webR and hosting on iOS iPad local server app by then opening webr-0.4.0 folder on the local server and pointing the server to index.html. WebR works great by that process and am able to install and use packages from the webR repository.
However, as per many other requests that have been posted, I'm interested in having my most commonly used R packages persist on my device instead of needing to download every time I open up my local server and browser and am more limited by mobile device sandboxing. I noticed that the webr-0.4.0 release that I downloaded includes a library folder:
webr-0.4.0/vfs/usr/lib/R/library
with what appeared to be the webR libraries that are standardly loaded when webR starts, and I presumed that webR loaded its libraries into the virtual FS by loading the libraries in the above folder. If so, I figured I could just download additional webR packaged libraries and add them to the above library folder and then webR would load with the additional packages preconfigured when I start webR. However, that doesn't occur-- despite having a webR package in the above folder on my local server (e.g. cli) it doesn't show up in the virtual FS for me to use when I start webR.
What then are the packages in the above library of the release version of webR for self-hosting used for? Would it be possible to point webR to that folder so that I can add additional libraries to it that would be automatically mounted to the VFS when webR loads on my local hosted server?
thanks!
The text was updated successfully, but these errors were encountered: