title: How do I use chmod with Node.js
body: <p>How do I use chmod with Node.js?</p>
  
  <p>There is a method in the package <code>fs</code>, which should do this, but I don't know what it takes as the second argument.</p>
  
  <blockquote>
    <p><strong>fs.chmod(path, mode, [callback])</strong></p>
    
    <p>Asynchronous chmod(2). No arguments other than a possible exception are given to the completion callback.</p>
    
    <p><strong>fs.chmodSync(path, mode)</strong></p>
    
    <p>Synchronous chmod(2).</p>
  </blockquote>
  
  <p>(from the <a href="https://nodejs.org/api/fs.html#fs_fs_chmod_path_mode_callback" rel="noreferrer">Node.js documentation</a>)</p>
  
  <p>If I do something like</p>
  
  <pre><code>fs.chmodSync('test', 0755);
  </code></pre>
  
  <p>nothing happens (the file isn't changed to that mode).</p>
  
  <pre><code>fs.chmodSync('test', '+x');
  </code></pre>
  
  <p>doesn't work either.</p>
  
  <p>I'm working on a Windows machine btw.</p>