store(originURL, destinationURL, doAutoAuth = true)
The pods:store() action is used to fetch a file from the originURL and put it at the destinationURL inside the connected storage. If the file already exists at destinationURL, pods:store() will fail. If the full path does not already exist on the storage server (aside from the file), pods:store() will fail. pods:connectStorage() should be called at some point prior to using this action (pods:connectStorage() does not need to be called again if the pico engine is restarted).
The pods:store() action has the parameters:
originURL — A required string parameter that provides the source of the file to the library, allowing it to fetch the file. The library is expecting an absolute URL using the
http,data, orfileURI scheme. Thefilescheme is used to locate files on the pico engine’s local machine. If adatascheme, theoriginURLcannot be more than 102,400 bytes.destinationURL — A required string parameter that provides the final location for the file to be housed at inside the storage. The library is expecting an URL using the
httpURI scheme. This URL should include the file name at the end (e.g.http://examplepodserver.org/podName/folder/file.txt).doAutoAuth — An optional boolean parameter that is true by default and controls automatic authentication attempts. When true, the library will check that the stored authentication token is valid if it exists, and if the token is not valid or the token does not exist, the library will attempt to automatically authenticate once.
Copyright Picolabs | Licensed under Creative Commons.