• Or a 3rd is s.list(/^filename$/) which would be more efficient than s.list.

    However I'd say s.read(...)!==undefined) is the best. Espruino doesn't actually load the file into memory - it just references it as a string - so it's actually very efficient to just check if it is undefined or not as the file data will never actually even be read.


Avatar for Gordon @Gordon started