Closed SaeedZhiany closed 1 month ago
KStore
is just a delegate to the underlying file of a given path/storage of a given key.
You can use the platform APIs to see if the file exists already / key exists already.
val path = Path("path/to/myFile")
SystemFileSystem.exists(file) // true if the file exists
Typically we always create the stores and observe it's values to determine if a previously written file/key exists or not
val store = storeOf(file = path)
val cat: Cat? = store.get()
if(cat != null) // previously written value exists
Feel free to comment further if you have any more issues.
how can I check if a store exists before calling
storeOf
function? in my application, I want to check whether a store with the given path/key was created before. I don't want to create it if it does not exist.