|
1 | 1 | # react-native-fs2 |
2 | 2 | _A fork of [react-native-fs](https://github.com/itinance/react-native-fs) with a smaller footprint and fixes due to the upstream library seemingly being abandoned._ |
3 | 3 |
|
4 | | - * todo |
| 4 | +### Why the fork? |
| 5 | +This library intentional or not has become critical to the success of our mobile applications. We've noticed a few things that led to this fork: |
| 6 | + |
| 7 | + * The original library continuing to expand beyond a basic file system library. |
| 8 | + * Hundreds of open issues |
| 9 | + * Pull requests go unmerged |
| 10 | + * Tests that go untouched |
| 11 | + * Some edge case bugs that stay unresolved |
| 12 | + |
| 13 | +We debated a few paths, but we felt it best to fork the project and make some major changes that will upset some. |
| 14 | + |
| 15 | + * We dropped Windows support. |
| 16 | + * We dropped methods specific to platforms. |
| 17 | + * We dropped upload support. |
| 18 | + |
| 19 | +We will continue to support this library for as long as we use it. |
| 20 | + |
| 21 | +### Installation |
| 22 | +```bash |
| 23 | +yarn add react-native-fs2 |
| 24 | +``` |
| 25 | + |
| 26 | +### Changelog |
| 27 | +Changes can be found in [CHANGELOG.md](CHANGELOG.md) |
| 28 | + |
| 29 | +### Usage |
| 30 | +```ts |
| 31 | +import RNFS from 'react-native-fs2'; |
| 32 | + |
| 33 | +console.log(await RNFS.getFSInfo()); |
| 34 | +``` |
| 35 | + |
| 36 | +#### mkdir |
| 37 | + |
| 38 | +#### moveFile |
| 39 | + |
| 40 | +#### copyFile |
| 41 | + |
| 42 | +#### getFSInfo |
| 43 | + |
| 44 | +#### getAllExternalFilesDirs |
| 45 | + |
| 46 | +#### unlink |
| 47 | + |
| 48 | +#### exists |
| 49 | + |
| 50 | +#### stopDownload |
| 51 | + |
| 52 | +#### resumeDownload |
| 53 | + |
| 54 | +#### isResumable |
| 55 | + |
| 56 | +#### completeHandlerIOS |
| 57 | + |
| 58 | +#### readDir |
| 59 | + |
| 60 | +#### readFile |
| 61 | + |
| 62 | +#### read |
| 63 | + |
| 64 | +#### hash |
| 65 | + |
| 66 | +#### writeFile |
| 67 | + |
| 68 | +#### appendFile |
| 69 | + |
| 70 | +#### write |
| 71 | + |
| 72 | +#### stat |
| 73 | + |
| 74 | +#### downloadFile |
| 75 | + |
| 76 | +#### touch |
| 77 | + |
| 78 | +#### scanFile |
| 79 | + |
| 80 | +### Constants |
| 81 | + |
| 82 | +#### Common |
| 83 | + * `CachesDirectoryPath` - Absolute path to cache directory. |
| 84 | + * `DocumentDirectoryPath` - Absolute path to the document directory. |
| 85 | + * `TemporaryDirectoryPath` - Absolute path to temporary directory (cache on Android). |
| 86 | + |
| 87 | +#### Android |
| 88 | + * `ExternalCachesDirectoryPath` - Absolute path to the external cache directory. |
| 89 | + * `ExternalDirectoryPath` - Absolute path to external shared directory. |
| 90 | + * `ExternalStorageDirectoryPath` - Absolute path to the external shared storage directory. |
| 91 | + * `DownloadDirectoryPath` - Absolute path to the download directory. |
| 92 | + |
| 93 | +> Please be sure to request needed permissions via [PermissionsAndroid](https://reactnative.dev/docs/permissionsandroid). |
| 94 | +
|
| 95 | +#### iOS |
| 96 | + * `LibraryDirectoryPath` - Absolute path to [NSLibraryDirectory](https://developer.apple.com/documentation/foundation/nssearchpathdirectory/nslibrarydirectory) |
| 97 | + * `MainBundlePath` - Absolute path to main bundle directory. |
0 commit comments