question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not listing the files using rn fetch blob in react native [Error: Attempt to get length of null array]

See original GitHub issue

I was trying to list all the files in a folder using rn fetch blob in react native. When i tried to list it i am getting an error saying

[Error: Attempt to get length of null array] here is the below code I have tried to list the files.


 try {
        var TRACK_FOLDER = RNFetchBlob.fs.dirs.DownloadDir + '/BlabberApp/';
        let files = await RNFetchBlob.fs.ls(TRACK_FOLDER)
        console.log(files);
      } catch (error) {
        console.log(error);
      }

Its working perfectly in system emulator and when i tested in real devices its force closing and throwing this error. I am pretty sure that i gave given storage permission for this but still I am getting this error.

Any help would be appreciable.

I am using the version : "rn-fetch-blob": "^0.12.0"

Thanks in advance 😃

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
yashwant-dangicommented, Jul 22, 2021

Android 10 introduce a new storage paradigm called scoped storage. Due to this is not working. <application android:requestLegacyExternalStorage="true" ... > ... </application> in AndroidManifest.xml. This is a temporary solution.

For me after adding this block, it started working.

Original Answer: https://github.com/joltup/rn-fetch-blob/issues/700#issuecomment-732417928

0reactions
fattahmuhyiddeencommented, Jul 7, 2021

same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not listing the files using rn fetch blob in react native [Error
I was trying to list all the files in a folder using rn fetch blob in react native. When i tried to list...
Read more >
[Solved]-Attempt to get length of null array on NfcManager.start()
Attempt to get length of null array on NfcManager. · Not listing the files using rn fetch blob in react native [Error: Attempt...
Read more >
Typeerror is not a function react native - Caritas Castellaneta
0 but it was solved with npm install react-native-reanimated@2. js - Error reading an image [TypeError: onChangeImage is not a function · React...
Read more >
How to use the react-native-fs.unlink function in react ... - Snyk
type]; await RNFS.unlink(CONFIG_DIRECTORY + dir + configVersion.name); } catch (e) { // do nothing - file doesn't exist } ...
Read more >
FileSystem - Expo Documentation
Within Expo Go, each project has a separate file system and has no access to the file system of ... Are you using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found