Node.js check if file exists

前端 未结 17 901
生来不讨喜
生来不讨喜 2020-12-07 10:02

How do i check the existence of a file?

In the documentation for the module fs there\'s a description of the method fs.exists(path, cal

17条回答
  •  伪装坚强ぢ
    2020-12-07 10:29

    There are a lot of inaccurate comments about fs.existsSync() being deprecated; it is not.

    https://nodejs.org/api/fs.html#fs_fs_existssync_path

    Note that fs.exists() is deprecated, but fs.existsSync() is not.

提交回复
热议问题