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

79
Views
Convertir respuesta a arraybuffer

Estoy tratando de convertir una respuesta a arraybuffer con axios. Sigo recibiendo un mensaje de error: "TypeError: response.arrayBuffer no es una función". A continuación se muestra el código que escribí y una sugerencia sobre lo que estoy haciendo mal o una solución a este error.

 axios .post("http://127.0.0.1:8000/api/file-api", formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", 'Access-Control-Allow-Origin':'http://localhost:8080', 'Access-Control-Allow-Credentials': 'true', 'Authorization': `bearer ${token}` }, }) .then((response) => response.arrayBuffer()) .then((res) => { const arrayBuffer = res.arrayBuffer(); const objUrl = window.URL.createObjectURL(new Blob([arrayBuffer])); return objUrl; }) .catch((err) => { console.log(err); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Después de leer esta publicación [Axios vs. fetch(): ¿Cuál es mejor para realizar solicitudes HTTP?][1],

[1]: https://blog.logrocket.com/axios-vs-fetch-best-http-requests/#:~:text=Axios%20automatically%20transforms%20the%20data,info%20on%20what%20the% 20respuesta . y luego el comentario de @Bravo, noté que usar axios no puede proporcionar un arraybuffer como un tipo de respuesta. En el caso de arraybuffer, es mejor usar fetch.

about 4 years ago · Juan Pablo Isaza Report
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!