diff --git a/FS.common.js b/FS.common.js index 8ba0b275..7d59bec9 100755 --- a/FS.common.js +++ b/FS.common.js @@ -620,6 +620,7 @@ var RNFS = { CachesDirectoryPath: RNFSManager.RNFSCachesDirectoryPath, ExternalCachesDirectoryPath: RNFSManager.RNFSExternalCachesDirectoryPath, DocumentDirectoryPath: RNFSManager.RNFSDocumentDirectoryPath, + DownloadDirectoryPath: RNFSManager.RNFSDownloadDirectoryPath, ExternalDirectoryPath: RNFSManager.RNFSExternalDirectoryPath, ExternalStorageDirectoryPath: RNFSManager.RNFSExternalStorageDirectoryPath, TemporaryDirectoryPath: RNFSManager.RNFSTemporaryDirectoryPath, diff --git a/README.md b/README.md index 132b9907..df102239 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,7 @@ The following constants are available on the `RNFS` export: - `CachesDirectoryPath` (`String`) The absolute path to the caches directory - `ExternalCachesDirectoryPath` (`String`) The absolute path to the external caches directory (android only) - `DocumentDirectoryPath` (`String`) The absolute path to the document directory +- `DownloadDirectoryPath` (`String`) The absolute path to the download directory (on android only) - `TemporaryDirectoryPath` (`String`) The absolute path to the temporary directory (falls back to Caching-Directory on Android) - `LibraryDirectoryPath` (`String`) The absolute path to the NSLibraryDirectory (iOS only) - `ExternalDirectoryPath` (`String`) The absolute path to the external files, shared directory (android only) diff --git a/android/src/main/java/com/rnfs/RNFSManager.java b/android/src/main/java/com/rnfs/RNFSManager.java index 1fd3fd20..7aab307a 100755 --- a/android/src/main/java/com/rnfs/RNFSManager.java +++ b/android/src/main/java/com/rnfs/RNFSManager.java @@ -48,6 +48,7 @@ public class RNFSManager extends ReactContextBaseJavaModule { private static final String RNFSExternalDirectoryPath = "RNFSExternalDirectoryPath"; private static final String RNFSExternalStorageDirectoryPath = "RNFSExternalStorageDirectoryPath"; private static final String RNFSPicturesDirectoryPath = "RNFSPicturesDirectoryPath"; + private static final String RNFSDownloadDirectoryPath = "RNFSDownloadDirectoryPath"; private static final String RNFSTemporaryDirectoryPath = "RNFSTemporaryDirectoryPath"; private static final String RNFSCachesDirectoryPath = "RNFSCachesDirectoryPath"; private static final String RNFSExternalCachesDirectoryPath = "RNFSExternalCachesDirectoryPath"; @@ -979,6 +980,7 @@ public Map getConstants() { constants.put(RNFSTemporaryDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath()); constants.put(RNFSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath()); constants.put(RNFSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath()); + constants.put(RNFSDownloadDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()); constants.put(RNFSFileTypeRegular, 0); constants.put(RNFSFileTypeDirectory, 1); diff --git a/index.d.ts b/index.d.ts index 508b1502..1e8d99b4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -284,6 +284,7 @@ export function touch( export const MainBundlePath: string export const CachesDirectoryPath: string export const ExternalCachesDirectoryPath: string +export const DownloadDirectoryPath: string export const DocumentDirectoryPath: string export const ExternalDirectoryPath: string export const ExternalStorageDirectoryPath: string