React-native-fs: The file seems to have been downloaded successfully,But i can't find it in the folder.

Created on 11 Jul 2017  Â·  4Comments  Â·  Source: itinance/react-native-fs

android version is ‘6.0.1‘
react-native version is ‘ 0.43.1’
Here is the code:

    var formUrl = common.baseUrl+'/enclosures/IMG_20170617_093953.jpg';
    const downloadDest = `${RNFS.DocumentDirectoryPath}/IMG_20170617_093953.jpg`;
    const options = {
           fromUrl: formUrl,
           toFile: downloadDest,
           background: true,
           begin: (res) => {
            console.log(res);
        },
        progress: (res) => {

        }
    };
    try {
        const ret = RNFS.downloadFile(options);
        ret.promise.then(res => {
            console.log(res);

        }).catch(err => {
            console.log(err)
        });
    }
    catch (e) {
        console.log(e)
    }
question

Most helpful comment

Hi, I'm not sure if you can view it from file manager, can u try this code to see content of document directory:
RNFS.readDir(RNFS.DocumentDirectoryPath).then((res)=>{console.log(res)});

This will verify your issue.

All 4 comments

Hi, I'm not sure if you can view it from file manager, can u try this code to see content of document directory:
RNFS.readDir(RNFS.DocumentDirectoryPath).then((res)=>{console.log(res)});

This will verify your issue.

@ngrj @ngrj
yes ,I can get an array,like this.
e_o_lj3ue y jyu qzwh19

so the file exists, afaik it just that you can't access content of document directory from other applications, only your own application can access it.

@ngrj Ok,thank you very much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AbdelkaderOumrani picture AbdelkaderOumrani  Â·  3Comments

zaheerahmad92001 picture zaheerahmad92001  Â·  3Comments

wangfpp picture wangfpp  Â·  3Comments

PimDeWitte picture PimDeWitte  Â·  4Comments

npomfret picture npomfret  Â·  4Comments