Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
How to get real Directory Path on iOS in React Native

I want to download a file in React Native and save it in a Directory selected by the User (e.g. Downloads).

Right now I'm using https://www.npmjs.com/package/react-native-document-picker to let the user pick a directory and https://www.npmjs.com/package/react-native-fs/v/1.2.0 to download the file.

Unfortunately, react-native-document-picker only gives me a dynamic URI to the directory, which does not exist when react-native-fs tries to access it. I think it's hidden behind something like a File-Provider.

I searched a lot but found no solution on how to get the real static path to a directory. Might be that I am missing something obvious, but I can not figure it out right now.

the code (simplified)

DocumentPicker.pickDirectory().then(pick => {

  // this looks something like:
  // file:///private/var/mobile/Containers/Shared/AppGroup/8443...EC/File%20Provider%20Storage/Downloads/
  const pickedDirectory = pick.uri;

  // resolves to false:
  RNFS.exists(pickedDirectory)

  // does not work
  RNFS.downloadFile({
    fromUrl: downloadUrl,
    toFile: pickedDirectory + filename,
  }).promise.then(r => { console.log(r)
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Either we can opt for the solution give on the below link (using react-native-fs).

React native Unable to use local tmp file path for Image.source iOS

or try

Add copyTo:"documentDirectory" in the pick document options. Then in pickedDirectory.fileCopyUri you'll get the document path.

What happens is when we pick any Item from gallery or iOS file system, it picks and place it a temporary directory for some time, then it get auto removed from that directory. Try the above given solution, I believe It will work.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda