title: Detect hidden/system files and folders in Node.js
body: <p>I am using <a href="https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback" rel="nofollow noreferrer">fs.readdir</a> to enumerate files and folders with recursion, and then <a href="https://nodejs.org/api/fs.html#fs_fs_stat_path_callback" rel="nofollow noreferrer">fs.stat</a> for each file, to get accessibility details.</p>
  
  <p>I need to detect all hidden and system files, based on the information from <a href="https://nodejs.org/api/fs.html#fs_fs_stat_path_callback" rel="nofollow noreferrer">fs.stat</a>, so I can skip them from enumeration.</p>
  
  <p>I know we get property <code>mode</code> that's supposed to help us, but I cannot find out how to use it properly, so it would work across every OS.</p>
  
  <p>P.S. I saw this question: <a href="https://stackoverflow.com/questions/18973655/how-to-ingnore-hidden-files-in-fs-readdir-result">How to ingnore hidden files in fs.readdir result</a>, but the answers there are no good.</p>