Server.downloadFile {extra parameter}
-
@Christoph-Hart Is it possible to use an extra parameter to the dowloadFile function this is passed to the callback?
This would help a lot to keep track of what we're doing when downloading multiple things. This way we don't need recursion because we can find the source of the download using an index for instance.I have nothing against recursion, but when you want to use already downloaded files and download new ones it becomes messy because you don't know anymore what file is arriving.
Having a parameter to pass in would make things so much easier...
If doable I'll add it to the gigantomatic new roadmap
-
You can get almost every information from the
this
object inside the callback, can't you? -
@Christoph-Hart I only get this from
trace(this.data)
Interface: { "numTotal": 107277, "numDownloaded": 98304, "finished": true, "success": true }
So no information about who instantiated the download
-
@Christoph-Hart I know it doesn't matter if you have only one file, but with an array, I'd like to pass the index since the callback is asynchronous. Recursion doesn't work in my edge case, because sometimes I download from the file array, sometimes the file already exists so the index changes before a file has a chance to arrive... so keeping track of the index isn't possible...
Well, I can look for what file is existing first and divide my array, but this complicates the code where a parameter would make it easier... -
Don't use
this.data
but the API functions here: https://docs.hise.audio/scripting/scripting-api/download/index.htmleg.
myURLList.indexOf(this.getFullURL())
-
@Christoph-Hart Oh thanks! I'll have a look on sunday...