LoginSignup
8
8

More than 5 years have passed since last update.

node.js(v10.15.3):ファイルの存在確認

Last updated at Posted at 2019-04-28

fs.existsSyncを使う。node.jsのバージョンは、"v10.15.3"を使用する。
https://nodejs.org/api/fs.html#fs_fs_existssync_path

$ node
> fs = require('fs')
(出力は省略)
> fs.existsSync('foo.txt')
true
> fs.existsSync('bar.txt')
false
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8