Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native-fs.the actual document directory path in android

I tried the code for creating a file, and i created two files, and that is

    // require the module
    var RNFS = require('react-native-fs');

    // create a path you want to write to
    var path = RNFS.DocumentDirectoryPath + '/test.txt';

    // write the file
    RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8')
    .then((success) => {
    console.log('FILE WRITTEN!');
    })
    .catch((err) => {
    console.log(err.message);
    });

i created two files with that code. but i cant see the actual created files. Where exactly it was saved?

like image 830
Pons Suarez Avatar asked Sep 15 '26 21:09

Pons Suarez


1 Answers

You can't see them on your phone. If you want to store files that you can see then use ExternalDirectoryPath or ExternalStorageDirectoryPath. I was also looking for an answer to a similar question but couldn't find any. So, I tried all these paths. My guess is DocumentDirectoryPath is used to store private data for your app. I am fairly new to Android development so take my words with grain of salt.

like image 132
Dark Matter Avatar answered Sep 18 '26 11:09

Dark Matter