RonRadtke / react-native-blob-util

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
763 stars 130 forks source link

Does 'read' config param stream? #379

Closed CyberCyclone closed 1 month ago

CyberCyclone commented 2 months ago

Hi,

I'm using the below code, however I can't see from the docs or clearly see in the code if using the path config writes directly to the filesystem via chunks, or does it download it all first into RAM and then writes it to storage?

const response = ReactNativeBlobUtil
      .config({
        path: outputPath // does this stream directly to the filesystem via chunks or to RAM first?
      })
      .fetch("GET", "https://myremotepath");
CyberCyclone commented 2 months ago

Based on my own testing, the file is streamed directly to the file-system. It would be good if the documents were more explicit.

RonRadtke commented 1 month ago

Feel fre to update it :) Under the hood we are using okhttp3 and the file will be written to the filesystem during onResponse. So unless we get multipe onResponse events the lib wil write it all at the end into the file. If okhttp internally uses any file caching I can't tell