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.

fs.stat failed on large File

See original GitHub issue
  • “rn-fetch-blob”: “^0.10.15”
  • “react-native”: “0.59.8”

Hi, i am trying to get an absolute path to my file which is selected with react-native-document-picker with uri : “content://com.android.providers.media.documents/document/video%3A69534”.

However, it only works if the file is not too large, in around 11MB, it will throw error when selecting file around 200MB.

The error message highlighted : "message:“failed to stat path /storage/emulated/0/...... because it does not exist or it is not a folder”

Below is the snippet of code i have :

DocumentPicker.show(
      {
        filetype: [DocumentPickerUtil.video()],
      },
      (error, res) => {
        if (res != null) {
          RNFetchBlob.fs
            .stat(res.uri) // res.uri = "content://com.android.providers.media.documents/document/video%3A69534"
            .then(stats => {
              console.log(stats);
              res.path = stats.path;
              this.onItemSelected(res, this.addFile);
            })
            .catch(err => {
              console.log(err);
            });
        }
      }
    );

Or is there alternative way for me to get an absolute path to the selected file?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:7

github_iconTop GitHub Comments

1reaction
AugustoAleGoncommented, Dec 15, 2020

I don’t if that helps. But I removed all the spaces between the file name and that actually works.

0reactions
GuiLeccommented, Aug 30, 2021

Have you tried RNFetchBlob.fs.stat(decodeURIComponent(uri)) ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

“Unknown system error -75” nodejs fs.stat large files #19455
This error can occur when, for example, an application compiled on a 32-bit platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose ...
Read more >
Problems with use fs.stat in nodejs
Your console.log is outside your fs.stat callback. Fixed it: var fs = require('fs'), size = new Object(); function writeinfile(file){ ...
Read more >
Node.js fs.stat() Method
The fs.stat() method is used to return information about the given file or directory. It returns an fs.Stat object which has several ...
Read more >
Node.js - File System
The Node File System (fs) module can be imported using the following syntax − ... return console.error(err); } console.log(stats); console.log("Got file ...
Read more >
How to Process Large Files with Node.js
Basic knowledge of the Node.js fs module; A large sample CSV file. For sample data, you'll be using New Zealand business statistics from...
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