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

168
Views
Blob is returning empty string after creation

I have an extremely large JSON string that I need to send to my server. I encountered payloadTooLargeError when I tried sending the JSON string directly.

So, I decided to send it as a blob instead. But unfortunately, after creating the blob, the blob is returning an empty string.

Here is how I created the blob:

 let largeContentPayload = {
        data: {
            'batch_id': batchId,
            content: extremelyLargeJSON
        }
    };
    const largeContentStringified = JSON.stringify(largeContentPayload);
    const largeContentBlob = new Blob([largeContentStringified], {
        type: 'application/json;charset=utf-8'
    });
    console.log(largeContentBlob); //This is only returning size and type, the JSON string is not there
    const blobUrl = URL.createObjectURL(largeContentBlob);
    let requestBody = new FormData();
    let blob = await fetch(blobUrl).then(r => r.blob());
   

How can this be resolved?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

By default if you try to log a blob object in the console it will only display the size and type of that blob.

If you want to see the text content of the blob, you can use text method in the blob.

Reference

Example

async function createBlob() {
  const obj = { hello: 'world' };
  const blob = new Blob([JSON.stringify(obj, null, 2)], { type: 'application/json' });
  console.log(blob);
  const text = await (new Response(blob)).text();
  console.log(text);
}
createBlob();

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!