Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda