Cant download file properly to a user accessible location
See original GitHub issueI am using the HTTP library to attempt to download a file.
In short, I want to download a file, from a URL, to my device in a place where the user can access it easily.
For simplicity in getting it working the first time I am using the example from the docs.
This is the code I am using:
download (id) {
console.log('Download Started');
getFile("https://raw.githubusercontent.com/NativeScript/NativeScript/master/apps/tests/logo.png").then(function (r) {
console.log(r.path);
}, function (e) {
//// Argument (e) is Error!
});
}
This outputs the path it was saved at as being:
/data/user/0/com.myapp.example/files/logo.png
When I try to go to this location on a file browser from the play store It is nowhere to be found.
Can anyone shed anymore light on this?
Obviously, I want this to work the same on ios and Android but I am testing on Android atm.
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (6 by maintainers)
Top Results From Across the Web
Fix file download errors - Google Chrome Help
If you try to download a file and it doesn't work, first try to fix the error with these troubleshooting steps: Make sure...
Read more >How to Deny or Allow Access to Downloads Folder ... - YouTube
Windows 10 Privacy Settings offer File System settings, which makes sure that ... If a user allows apps access to their Downloads folder, ......
Read more >[Solved] Can't Open Downloads Folder in Windows 10
The first thing to do when you see a not responding/inaccessible Downloads folder is to run the System File Checker. The purpose of...
Read more >Microsoft Edge Can't Download Files? Here's How to Fix It
Open the browser's menu. Head to Settings > Downloads. Click Change next to Location and set a new download path. Check if Edge...
Read more >What to do if you can't download or save files | Firefox Help
1 Check the Downloads panel for blocked downloads · 2 Clear the download history · 3 Choose a different download folder · 4...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@NickIliev How to use http getFile function with nativescript angular? I have looked in NS Angular http class, but its not having the getFile funtion.
@RyanSMurphy, in order to access the native APIS, thought any TypeScript enabled project you will need the TypeScript declaration files for the native APIs. The good news is that you don’t need to generate those files as we are providing them with tns-platform-declarations package. However to enable them under Angular-2 project requires some additional steps as follows:
then open tsconfig.json and add the lib option
and finally open references.d.ts and modify its tcontent to look like this
For reference, you can take a look at how these are set in this application.