fs.exists, fs.existsSync - why are they deprecated?

前端 未结 7 565
遥遥无期
遥遥无期 2021-01-07 20:06

I noticed that the official node documentation says something startling about fs.exists:

\"fs.exists() is an anachronism and exists only

7条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 20:29

    Because of the second paragraph you quoted.

    There is no point in checking whether a file exists, because it could always be deleted right after the check.

提交回复
热议问题