• Gaston Doval
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,
I have received the Attachement.Body from REST API call as mentioned in https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_blob_retrieve.htm from client side. 
When I get the blob returned and try to create a js file object,as below: 
    var body = [blobData];
    this.file = new File(body , fileName , {type: contentType , lastModifiedDate: new Date(), name: fileName} );
Now btoa(blobData) throws error Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range  for image/pdf. It works fine for text.
Please help to figure this out.