Check nodejs path

I just want to know if the path exists. Here is my code:

var path = require('path'); // exists path 
+4
source share
1 answer

to try:

 var path = require('path'); if (path.existsSync("/the/path")) { // or fs.existsSync // ... } 

or

 fs.exists('/the/path', function (exists) { util.debug(exists ? "it there" : "no exists"); }); 
+8
source

Source: https://habr.com/ru/post/1439641/


All Articles