I need to download huge file from webserver to device (mac/win/ios/android).
Seems haxe.Http is not suitable for this task, since it returns whole request data - which in my case can be bigger than available memory. So there is streamed/partial download needed, to append data to local file until all bits are downloaded, without keeping all this stuff in memory
What can be used to perform such task? Any ideas welcome //
It is available for all platforms. OpenFL replicates the whole flash API and uses flash classes when you compile to flash/air, but it has its own classes for other platforms. Platform availability is specified for each class in the api documentation.
Typically anything you can do in as3 can be done exactly the same in openFL, with slight syntax differences.
AS3 Classes that are only available in AIR may require finding an alternate solution, for example here is a function that loads data from a file in a game :
/**
@param fileName
@return
**/
static public function gameLoad(fileName:String):String
{
var data:String = "";
#if air
var file:flash.filesystem.File = flash.filesystem.File.applicationStorageDirectory.resolvePath("save/" + fileName + ".dat");
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.READ);
data = fileStream.readUTFBytes(fileStream.bytesAvailable);
fileStream.close();
#elseif cpp
var path:String = System.applicationStorageDirectory + "save\\";
data = File.getContent(path + fileName + ".dat");
#end
return data;
}
I use AIR to compile and test very quickly, but real builds target windows (c++)