I often find myself in a situation, where I want to take a (reactive) object from a shiny session, and write or read it to/from blob storage (say, Google Cloud Storage, ...) or a remote file system (say, via rsync, ..., or god forbid, Dropbox).
I use this on shinyapps.io, where no persistent local storage is available, but also on other shiny environments, because I generally like to consider my shiny boxes disposable.
R packages to talk to the storage backends, for the most part, already exist, but I got a bit tired of calling them ad-hoc in my server.R
, so I've written some functions for internal use that abstract some things away, and add some (planned) bells and whistles, such as:
- encapsulation in a module
-
some across-session
shiny::throttle()
orshiny::debounce()
lest I overwhelm / race-condition the blob storage or remote file system -
create unique filenames from
session$token
. - async via {promises}
-
some subtle ui feedback to let the user know what is happening, maybe via
showNotification()
. - maybe parallelisation, though this might be overkill/irrelevant because most (?) shiny sessions are single threaded anyway (?).
I'm considering factoring this out into a little package, but I'm wondering:
- has this been done already and am I just too dense to find it?
- is this a bad idea of a really convoluted package? (wouldn't be the first time that's happened to me)
- what would folks want in such a package?
I am aware of these related resources/packages:
- {shinyStorage}: in-browser key-value storage
- {shinyStore}: client-side HTML5 local storage
- @daattali's seminal article on persistent data storage on shinyapps.io
- @thomasp85's {shinyFiles}, a shiny file browser.
- ...
I also asked this on twitter.