Skip to content

Regression in 0.24.10: streaming a response with no Content-Length to a file path truncates it at 8 KB #477

Description

@AjayFrancisTechversant

Summary

Since 0.24.10, .config({ path }).fetch(...) (stream-to-file mode) writes only the first 8 KB (8192 bytes) of a response when the server does not send a Content-Length header. The rest of the body is silently dropped, producing a truncated/corrupt file. 0.24.9 writes the full file correctly — this is a regression introduced between 0.24.9 and 0.24.10.

Environment

react-native-blob-util 0.24.10 (broken) — 0.24.9 works
react-native 0.85.3
Platform Android (confirmed on emulator + physical device, Hermes). iOS not yet verified.
Server Responds over HTTP/2 with the file bytes but no Content-Length header (chunked/streamed).

Steps to reproduce

  1. Have a server endpoint that returns a binary file (e.g. a ~13 KB PDF) without a Content-Length response header.
  2. Download it to a file using stream-to-path mode:
const res = await ReactNativeBlobUtil
  .config({ path: localFilePath, timeout: 20000 })
  .fetch('POST', url, headers, body);

// res.info().status === 200
  1. Inspect the file on disk.

Expected

The file on disk is the full response body (e.g. 13264 bytes).

Actual

The file on disk is exactly 8192 bytes (the first 8 KB), regardless of the true size. The download reports success (status === 200), so there's no error surfaced — the file is just silently truncated and therefore corrupt. (In our case react-native-pdf then rejects it as "Unsupported URL".)

Key observation — the network read is fine; the file writer is the problem

On the same 0.24.10 build and the same endpoint:

  • Reading the response into memory returns the complete body:
    const full = res.base64();          // full 13264 bytes ✅
    await ReactNativeBlobUtil.fs.writeFile(path, full, 'base64');  // full file ✅
  • Streaming the response directly to a file path truncates it:
    .config({ path }).fetch(...)        // only 8192 bytes on disk ❌

So the bytes are received correctly off the wire — the truncation is in the stream-to-file write path when Content-Length is absent (it appears to stop after the first read buffer / 8 KB chunk
rather than draining the stream to EOF).

Regression range

  • 0.24.9 (published 2026-05-19) — writes the full file ✅
  • 0.24.10 (published 2026-06-19) — truncates at 8 KB ❌

Downgrading to 0.24.9 fully resolves it. It looks like a change in the native download/stream-write logic (Android) between these two patch releases.

Workaround

Either pin to 0.24.9, or avoid stream-to-path and buffer in memory (res.base64() + is undesirable for large files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions