exists 的同步版本,检查指定路径的文件或目录是否存在。
exists
文件或目录的路径。
存在返回 true 的操作结果。
const result = existsSync('/path/to/file.txt');if (result.isOk() && result.unwrap()) { console.log('文件存在');} Copy
const result = existsSync('/path/to/file.txt');if (result.isOk() && result.unwrap()) { console.log('文件存在');}
exists的同步版本,检查指定路径的文件或目录是否存在。