findFile(fileName, doAutoAuth = true)
The pods:findFile()
function uses a breadth-first search to check if a file exists in the connected pod’s file system. It checks all the files inside each folder and then searches each subfolder to find the exact file name. This function returns the path to the file as a string if the file is found. If the file is not found, this function returns null
. This function should be used with caution as it will search the full storage and take a long time in pods with large file structures.
The pods:findFile()
function has the following parameters:
fileName — A required string parameter that is the name of the file to search for inside the connected storage (e.g.
exampleName.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.