LayTexas
LayTexas

Reputation: 645

What is the path of the cache directory on Android and iOS?

I need to insert the path of the cache directory, that the image will be saved on android and iOS, by the library, but I don't know which path this is. Can someone please tell me which way it is?

export const openImage = (setFunc, w, h) => {
  ImagePicker.openPicker({
    cropping: true,
    path: "INSERT PATH HERE",
    mediaType: 'photo',
    width: p42(w) * 2.5,
    height: p42(h) * 2.5,
  })
    .then(response => {
      // alert(JSON.stringify(response));
      setFunc(response.path);
    })
    .catch(error => console.log('>>>>', error))
    .finally(() => ImagePicker.clean());
};

Upvotes: 0

Views: 3878

Answers (1)

Rajan
Rajan

Reputation: 1568

You can use react-native-fs for that.

CachesDirectoryPath (String) The absolute path to the caches directory

ExternalCachesDirectoryPath (String) The absolute path to the external caches directory (android only)

Upvotes: 0

Related Questions