Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Can I use RNFetchBlob with "path" config to save to local file system? #126

Closed
@yaronlevi

Description

@yaronlevi

Hi... I want to save users image thumbnails to the file system in react native. (think of a chat app, with small round images). I want those images to be saved to local file system, so in the next time they will be loaded directly from file system (and not downloaded again).

So I look at this code:

let dirs = RNFetchBlob.fs.dirs
RNFetchBlob
.config({
  // response data will be saved to this path if it has access right.
  path : dirs.DocumentDir + '/userThumbnails/12dfg472kadf4.png'
})
.fetch('GET', 'http://www.example.com/file/example.zip', {
  //some headers ..
})
.then((res) => {
  // the path should be dirs.DocumentDir + 'path-to-file.anything'
  console.log('The file saved to ', res.path())
})

This code will happen once when first downloading the image.
Will this code write the file 12dfg472kadf4.png to the file system?
I do not want it to be a cached file or something like that. I want it to be a regular file sitting in the file system, persisted, which I can use as a src property for an from now on.
Am I correct?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions