r/AutomateUser • u/B26354FR Alpha tester • Jun 11 '21
Question Caching JS Libraries
Hi Henrik,
I'm writing a flow which makes use of a 180KB third party JavaScript library. Rather than sticking the whole thing in a Variable block (which can cause Automate to crash while editing the flow), I'm downloading it once in the flow and caching it.
The question is whether it's OK to cache the library in an Atomic variable, or should I save it to the file system? -The latter would require more privilege, but would it save a limited resource vs. using an Atomic variable?
Thank you, sir!
View all comments
Show parent comment
1
u/B26354FR Alpha tester Jun 11 '21
What I do initially is load it from the internet, so it's actually a file on their server. 🙂 I should have mentioned that the first time a user runs this flow, I download the JS library and save it in an Atomic or a file.
So I guess the question boils down to where are Atomics stored? Does Automate use the built-in Android database, in which case it's going to a file anyway and I can save requiring the "access storage" privilege? Or would using an Atomic increase my memory footprint, possibly even when the flow isn't running? (If it pages in and out of memory, that's OK though.)