overwrite(originURL, destinationURL, doAutoAuth = true)
The pods:overwrite()
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:overwrite()
will replace the original file with the file at originURL
. If the full path for destinationURL
does not already exist inside the storage server, pods:overwrite()
will create containers to create the path. 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). Due to pods:overwrite()
being generally unsafe, it is recommended to use pods:store()
instead.
The pods:overwrite()
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
, orfile
URI scheme. Thefile
scheme is used to locate files on the pico engine’s local machine. If adata
scheme, theoriginURL
cannot 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 pod. The library is expecting an URL using the
http
URI 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 controls automatic authentication attempts. It defaults to true if nothing is passed in for it. 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.