0

I thought I could do it with the 'fs' module, but i couldnt find the right function.

kakush
  • 3,334
  • 14
  • 47
  • 68

2 Answers2

2
fs = require('fs');        
fs.exists(path, function( exists ) {        
    console.log( ( exists  ? "File is there" : "File is not there" ) );         
});
Nosherwan Adil
  • 141
  • 1
  • 5
1

See the documentation for the fs module, in particular the "stat" family of functions (stat, fstat, lstat, statSync, fstatSync, lstatSync).

maerics
  • 151,642
  • 46
  • 269
  • 291