title: Convert an image to byte array using javascript
body: <p>The idea of the task is to create a incident in ticketing platform and attach a screenshot to the ticket created using a chat-bot. For the attachment to be done for the ticket created , i am using a upload attachment API which accepts the image in byte array type only. </p>
  
  <p>API Body :</p>
  
  <blockquote>
    <p>{"_ProxyDetails":{"Password":"test@123","ProxyID":0,"ReturnType":"JSON","UserName":"user@itsm.com","OrgID":1,"TokenID":""},"eModule":"IM","TicketID":14487, "FileByte":"", "AttachmentFileName":"testtextfile.txt"}</p>
  </blockquote>
  
  <p>Where <code>FileByte</code> needs to be a byte array. I need the image to be converted to byte array using  built in JavaScript library only. Can anyone help me to convert this image to <code>bytearray</code> type?</p>
  
  <p><a href="https://i.stack.imgur.com/ZrqFQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZrqFQ.jpg" alt="enter image description here"></a></p>