react-native-fs
react-native-fs copied to clipboard
Download file in downloads folder
I need to downloaded file download in downloads folder of my device. When I downloaded file then it keeps in another place
+1 facing same issue.
@uc-asa have you found a solution yet?
Not yet if found any solution then inform me. I'm continuously working on it.
On Tue, Dec 13, 2016 at 4:22 AM, Junior Ally [email protected] wrote:
+1 facing same issue.
@uc-asa https://github.com/uc-asa have you found a solution yet?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/johanneslumpe/react-native-fs/issues/200#issuecomment-266579238, or mute the thread https://github.com/notifications/unsubscribe-auth/APpuJe98XIM6iWnNE41cfF6VRVCw9_xoks5rHdAigaJpZM4KqMLU .
-- Thanks,
Asheesh Kumar Sahu Software Engineer(Apps) uCertify
Hi @johanneslumpe, by default i need to store downloaded file into downloads directory. But now it downloaded into /data/user/0/com.demoapp/files/ directory. I need your assistance to fix this issue.
Any solutions?
Please provide more info. What do you do? Whats your code? What happens exactly and what do you expect instead?
react-native-fs gives you a few directories to download your file like DocumentDirectory
.
We need the Downloads directory from the device. Can you give us any advice?
There is no specific download-directory of the device. You specify the final location by yourself and it will exactly download each byte onto this location and not some where else. If you don't believe me, just take a Debugger (XCode for iOS, Android Studio on Android) and step thru each line while downloading :) Does this answer your question?
Not really. I needed a constant to find the external public storage to create my own folder. By the way Android has one. Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()
Thanks for your time. I don't need any further help because I switched to another library.
@gabriel-miranda, which one?
Any progress on this?
It would be great if react-native-fs
provided additional directories similar to how react-native-fetch-blob
(link) does it.
After all I'd consider those a crutial part of file-system specifics.
const path =
${RNFS.ExternalStorageDirectoryPath}/Download/${fileName};
Need to add the Download folder in the path. Files can then be found in Downloads.
const path =
${RNFS.ExternalStorageDirectoryPath}/Download/${fileName};
Need to add the Download folder in the path. Files can then be found in Downloads.
Yes, but actually the Download
part within that path should come from java android.os.Environment.DIRECTORY_DOWNLOADS
. The problem is that we don't have access to that env variable in any way through react-native-fs. It's not ensured to always be just Download
, although I didn't check whether it's actually something different under any circumstances. Even if it were always the same, using a static Download
instead of android.os.Environment.DIRECTORY_DOWNLOADS
is still dirty and error-prone.
I have the same problem, but i fixed: example
let options = {
html: '<h1>PDF TEST</h1>',
fileName: 'pdf1',
directory: 'Download', // change Downloads for Download
};
let file = await RNHTMLtoPDF.convert(options)
// console.log(file.filePath);
alert(file.filePath);
}
hlo friends ,i am working on react-native-viewShot and i want to store Screen Shot in my Mobile but i don't find any answer . View Shot in chache folder and i want to store View Shot in Downloads or Images folder please help me . Please Share your code of Storing ViewShot in Download folder. Thank You
Hi @johanneslumpe, by default i need to store downloaded file into downloads directory. But now it downloaded into /data/user/0/com.demoapp/files/ directory. I need your assistance to fix this issue.
hii bro are you find answer of your question because i have also same problem.
I agree the assertion that the constant should be more broadly available so we could use direct access to the right folders. rn-fetch-blob
being unmaintened doesen't help too.
const path =
${RNFS.ExternalStorageDirectoryPath}/Download/${fileName};
Need to add the Download folder in the path. Files can then be found in Downloads.
path should be
const path = ${RNFS.ExternalStorageDirectoryPath}/Downloads/${fileName}
const path =
RNFS.ExternalStorageDirectoryPath/Download/{fileName};
Need to add the Download folder in the path. Files can then be found in Downloads.
Surprisingly, this works. I was trying to create a folder in the top-level RNFS.ExternalStorageDirectoryPath but that fails. Appending the /Download fixes it and my folder now exists in the folder "Internal storage > Download" on the phone. Thanks.
Note: Without /Download it fails to create: /storage/emulated/0/banana (or at least I cannot view it on my phone) With /Download it creates the folder: /storage/emulated/0/Download/banana (and I can view this on my phone ok)
const path =
RNFS.ExternalStorageDirectoryPath/Download/{fileName};
Need to add the Download folder in the path. Files can then be found in Downloads.Surprisingly, this works. I was trying to create a folder in the top-level RNFS.ExternalStorageDirectoryPath but that fails. Appending the /Download fixes it and my folder now exists in the folder "Internal storage > Download" on the phone. Thanks.
Note: Without /Download it fails to create: /storage/emulated/0/banana (or at least I cannot view it on my phone) With /Download it creates the folder: /storage/emulated/0/Download/banana (and I can view this on my phone ok) I am getting this error
ENOENT: no such file or directory, open '/storage/emulated/0/Downloads/mamasample-15s.mp3'
I am getting this error
ENOENT: no such file or directory, open '/storage/emulated/0/Downloads/mamasample-15s.mp3'
It must be Download
in singular. One reason why it should be a constant within this library...
I am getting this error
ENOENT: no such file or directory, open '/storage/emulated/0/Downloads/mamasample-15s.mp3'
It must be
Download
in singular. One reason why it should be a constant within this library...
ya i used Download
still getting this error
@ole-flavia which android version you have tested it?