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

360
Views
Convertir blob en objeto JSON en Express Backend

Tengo un objeto JSON extremadamente grande que deseo enviar a mi servidor ExpressJS como un blob. Pude crear el blob en la interfaz, pero no estoy seguro de cómo volver a convertir el blob en el objeto JSON original en el backend.

Aquí está mi objeto JSON grande y cómo lo convertí en la interfaz:

 let largeObject = { ...... //Redacted }; const largeObjectStringified = JSON.stringify(largeObject); const largeObjectBytes = new TextEncoder().encode(largeObjectStringified); const largeObjectBlob = new Blob([largeObjectBytes], { type: "application/json;charset=utf-8" }); const blobUrl = URL.createObjectURL(largeObjectBlob); //Request body to send to server via axios let requestBody = new FormData(); let blob = await fetch(blobUrl).then(r => r.blob()); requestBody.append('file', new File([blob], 'file', { type: 'application/json' })); axios.post(endPoint,requestBody);

Ahora, en mi servidor Express, estoy leyendo el blob entrante de esta manera:

 let busboy = new Busboy({ headers: req.headers }); let uploadPath = path.join(__dirname, '..'); uploadPath = path.join(uploadPath, 'uploads/'); let filePaths = []; busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { let filePath = path.join(uploadPath, filename); filePaths.push(filePath); let writeStream = fs.createWriteStream(filePath); file.pipe(writeStream); }); busboy.on('finish', async function () { let blobFilePath = filePaths[0]; //How do I read back the JSON Object from the file path? });

Gracias

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!