The main issue here is the two distinct file types. If you want to check two you could do:
require("Storage").open(name,"r").addr!=0 || require("Storage").read(name)!==undefined
But I guess I wonder what you're trying to do here? If you are writing the code you presumably know which type of file you're trying to create, so you'd know what to check for?
Given the issues around StorageFile I may end up ignoring them in .list at some point and moving to using .listSF or something, so checking for both types of file explicitly (if you have to) is probably the best option.
© Espruino, powered by microcosm.
Report a problem