javascript check if path exists