Can I get somekind of SPIFFS on my device with To...
# help
k
Is it possible to save simple text, to my device' memory for later use with Toit? I'd like to be able to save a simple text-message, which then should be read incase of loss of connection or crash of the device. Is this possible?
f
You can use the
FlashStore
for that. https://libs.toit.io/device/class-FlashStore
Copy code
import device show FlashStore

main:
  store := FlashStore
  store.set "key" "value"
  print (store.get "key")
There is also a
Store
interface in the same library. You should use that one in all places except where you allocate the
FlashStore
. This way it gets easier to replace it with something else (for example for testing).
k
Nice, I'll try it out. Thanks!