title: Bencevans Screenshot-Desktop function using NodeJs in Laravel
body: <p>I have succeeded to run the Bencevans Screenshot-Desktop function using NodeJs, but at the moment I have trouble implementing it in Laravel. this is my code:</p>
  <pre><code>const screenshot = require('screenshoot-desktop')
  const fs = require('fs')
  
  screenshot().then((img) =&gt; {
  fs.writeFile('out.jpg', img, function (err) {
     if (err) {
        throw err
     }
     console.log('written to out.jpg')
  })
  }).catch((err) =&gt; {
        throw err
  })
  </code></pre>
  <p>and in Laravel I tried this way on blade code</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
       &lt;meta charset=&quot;UTF-8&quot;&gt;
       &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
       &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;
  &lt;title&gt;Capture&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;button&gt;Test&lt;/button&gt;
  &lt;script&gt;
      const screenshot = require('screenshoot-desktop')
      const fs = require('fs')
  
      screenshot().then((img) =&gt; {
      fs.writeFile('out.jpg', img, function (err) {
          if (err) {
          throw err
          }
          console.log('written to out.jpg')
      })
      }).catch((err) =&gt; {
      throw err
      })
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Ya of course that is wrong, but I confuse to implement in Laravel, anybody could help? appreciate it</p>