You can't at the moment - the best you could do is require("fs").readdir().indexOf("foo")>=0
require("fs").readdir().indexOf("foo")>=0
Perhaps it should return undefined rather than an empty string if the file doesn't exist?
undefined
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You can't at the moment - the best you could do is
require("fs").readdir().indexOf("foo")>=0
Perhaps it should return
undefined
rather than an empty string if the file doesn't exist?