Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Create File object in javascript from byte array

I am receiving an array of bytes from API (JAVA & Springboot). Now I want to create a javascript File object and pass that file to the FileUploader(angular-file-upload).

    $scope.reply_query_attachment = new FileUploader({
       'queueLimit': '20',
       headers: {'Access-Control-Allow-Origin': '*'}
    });
    I tried to add a file to this File uploader queue
      let file = new File([byteArr], 'test.pdf')
      let fileItem = new FileItem($scope.reply_query_attachment,file,{});
      $scope.reply_query_attachment.queue.push(fileItem);

angular.forEach($scope.reply_query_attachment.queue, function (value, index) {
                        value.url = "https://" + $scope.url;
                        value.formData.push({'key': $scope.key + $scope.reply_query_attachment.queue[index].file.name,
                                             'AWSAccessKeyId': $scope.accessKey,
                                             'acl': 'private',
                                             'policy': $scope.policy,
                                             'signature': $scope.signature,
                                             'success_action_status': '201'
                                            });
                    });
                    $scope.reply_query_attachment.uploadAll();

But the uploaded file is always corrupted. I couldn't create a valid javascript File object from the byte Array. Is there any way to add the byte array to the Fileuploader queue?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!