title: Best way to save files node.js
body: <p>I'm triying to <strong>upload</strong> an <strong>excel</strong> <strong>file</strong> with <strong>postman</strong> and save it in to a folder with <code>node.js</code> <code>fs</code>:</p>
  
  <pre><code>var file = req.body.file;
  
          fs.writeFile("public/myExcelFile.xlsx", file, function(err) {
             if(err) {
                 res.json(err);
             } else {
                  res.json("The file was saved!");
             }
           });
  </code></pre>
  
  <p>But when I try to open the file after upload it is corrupt or empty,
  can you tell me pls what im doing wrong? </p>
  
  <p>In the future I have to upload another files like .<strong>docx</strong> or .<strong>csv</strong> so I want to know what is the best way to save these files, it's better <strong>save</strong> files in database(I´m using Sql server) as a <code>blob</code> ? or save the file in a folder and <strong>save</strong> the <strong>path</strong> in database?</p>