I am writing a process where users will need to select a file that far exceeds their availble RAM and have that file broken up into small chunks (for upload).
I'm able to create a File reference to said file, but when I try to pass it to the fileStream, it appears to try to read the thing into memory before acting on it.
Is there a way to get fileStream to just take the reference to the file and then utilize readBytes the way it's documented?
Here is my code... it's called when the user selects the File in the browser dialogue.
private function selectHandler(event:Event):void {
var file:File = File(event.target);
trace("selectHandler: name=" + file.name );
var stream:FileStream = new FileStream();
var f:File = event.target as File;
stream.open(f, FileMode.READ); //here the process will lock up if the file you pass it is too large.
var bytes:ByteArray = new ByteArray();
stream.readBytes(bytes,0,1024);
trace(bytes);
stream.close();
}
Much obliged, in advance.