title: Convert buffer data to an image
body: <p>how do i convert this buffer data to an image so when am looping thru the result and rendering it in the img src it will render as an image that the user can see</p>
  
  <p>am using ejs to render it</p>
  
  <pre><code>     &lt;span&gt;
          &lt;img class="user-with-avatar" src=&lt;%=item.photo%&gt; /&gt;
       &lt;/span&gt;
  
  </code></pre>
  
  <p>when i console.log(result.data.photo), i get this</p>
  
  <pre><code>{"type":"Buffer","data":[100,97,116,97,58,14,79,8,113,97,65,43,57,55,89,69,88,51,66,101,70,86,112,121,112,121,121,121,80,81,104]},
  {"type":"Buffer","data":[100,97,116,97,58,14,79,8,113,97,65,43,57,55,89,69,88,51,66,101,70,86,112,121,112,121,121,121,80,81,104]},
  {"type":"Buffer","data":[100,97,116,97,58,14,79,8,113,97,65,43,57,55,89,69,88,51,66,101,70,86,112,121,112,121,121,121,80,81,104]}
  
  </code></pre>
  
  <p>how do i fix it with this code arrangement </p>
  
  <pre><code>
      app.get('/products', function (req, res) {
              if (req.session.token &amp;&amp; req.session.user_id) {
                  let data = {
                      token: req.session.token,
                      id: req.session.user_id,
                  }
                  let url = `https:/url/product/get_products?id=${data.id}&amp;token=${data.token}`
                  functions.callAPIGet(
                      url,
                      function (error, result) {
                          res.render('products', {
                              result: result.data
                          })
                      }
                  );
              } else {
                  res.redirect('/login')
              }
          });
  
  </code></pre>