pure javascript check if file exists