title: How to use zlib.gzipSync(buffer[, options]) for compressing files, and zlib.gunzipSync(buffer[, options]) for decompressing files?
body: <p><strong>Hi everyone</strong></p>
  
  <p>I've been going through my head about using zlib in synchronous mode, (Is important to me to be Sync mode)</p>
  
  <p>I have tried and failed multiple times, the node documentation is not entirely clear and use examples are missing</p>
  
  <p><strong>What I intend to do is:</strong></p>
  
  <p>A function for
  compress a text file "myfile.txt" that contains some data as text as "Some text" and save it as "myfile.txt.gz"</p>
  
  <pre><code>function zip(fullPathToFile){
    const zlib= require('zlib');
  
    //some cool stuff...using:
  
    zlib.gzipSync(buffer[, options])
  
  }
  </code></pre>
  
  <p>A function for unzip "myfile.txt.gz" into "myfile.txt"</p>
  
  <pre><code>function unZip(fullPathToFile){
    const zlib= require('zlib');
  
    //some cool stuff...using:
  
    zlib.gunzipSync(buffer[, options])
  
  }
  </code></pre>
  
  <p>all in the same directory</p>
  
  <p>any idea?</p>
  
  <p>thanks for all the reading and helping time</p>