Nativescript and resources folder - is there a simple solution?


I will start with the fact that currently I’m uploading successfully
an mp3 file to a server - but via a hacky way.

I’m having 2 raw folders as you can see :

enter image description here

And here is the working code to upload the file :

        let file = fs.path.join(fs.knownFolders.currentApp().path, "raw/a1.mp3");
        var request = {
            url:         "",
            method:      "POST",
        var task = session.uploadFile(file, request);
        task.on("progress", this.logEvent);

Here is the output for the successful upload (showing progress)

So where is the problem ?

The current file is being uploaded from the root raw folder. (proof)

But the right way (as I was told)is to upload it via the raw folder or the assets folder and then reference it via res://raw/a1.mp3 ( or res://raw/a1).

So I’ve switched to : let file="res://raw/a1.mp3";

But got an error:

ERROR Error: Could not find file at
path: res://raw/a1.mp3

Also for : let file="res://raw/a1"; //without extension - Got an error :

JS: ERROR Error: Could not find file at
path: res://raw/a1

How can I access the mp3 file under the raw folder? (not the outside folder but the resource one)