Skip to content

Cant download file properly to a user accessible location #589

@RyanSMurphy

Description

@RyanSMurphy

I 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions