You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
Replace rn-fetch-blob with react-native-fs based on CompanyCam#1 rn-fetch-blob does odd things like writing 404 responses to file which if for some reason aren't caught and deleted will cause the next request to return the cached 404 response, react-native-fs still returns a success response with 404 status but doesn't write the response to the destination.
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,15 +25,15 @@ Or
25
25
$ yarn add react-native-image-cache-hoc
26
26
```
27
27
28
-
Then, because this package has a depedency on [rn-fetch-blob](https://github.com/joltup/rn-fetch-blob) you will need to link this native package by running:
28
+
Then, because this package has a depedency on [react-native-fs](https://github.com/itinance/react-native-fs) you will need to link this native package by running:
29
29
30
30
```bash
31
-
$ react-native link rn-fetch-blob
31
+
$ react-native link react-native-fs
32
32
```
33
33
34
-
Linking rn-fetch-blob**should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.
34
+
Linking react-native-fs**should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.
35
35
36
-
To troubleshoot linking, refer to [the rn-fetch-blob installation instructions](https://github.com/joltup/rn-fetch-blob#user-content-installation).
36
+
To troubleshoot linking, refer to [the react-native-fs installation instructions](https://github.com/itinance/react-native-fs#usage-ios).
Copy file name to clipboardExpand all lines: src/FileSystem.js
+45-25Lines changed: 45 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,23 @@
9
9
10
10
import{Platform}from'react-native';
11
11
importpathLibfrom'path';
12
-
importRNFetchBlobfrom'rn-fetch-blob';
12
+
importRNFSfrom'react-native-fs';
13
13
importsha1from'crypto-js/sha1';
14
14
importURLfrom'url-parse';
15
15
16
+
/**
17
+
* Resolves if 'unlink' resolves or if the file doesn't exist.
18
+
*
19
+
* @param {string} filename
20
+
*/
21
+
constRNFSUnlinkIfExists=(filename)=>
22
+
RNFS.exists(filename).then((exists)=>{
23
+
if(exists){
24
+
returnRNFS.unlink(filename);
25
+
}
26
+
returnPromise.resolve();
27
+
});
28
+
16
29
exportclassFileSystem{
17
30
/**
18
31
* All FileSystem instances will reference the cacheLock singleton "dictionary" to provide cache file locking in order to prevent concurrency race condition bugs.
0 commit comments