Browse Source

use read(-1) instead of readall()

frabbit 11 years ago
parent
commit
e22241b77a
2 changed files with 6 additions and 1 deletions
  1. 1 1
      std/python/_std/sys/io/File.hx
  2. 5 0
      tests/unit/TestPython.hx

+ 1 - 1
std/python/_std/sys/io/File.hx

@@ -45,7 +45,7 @@ class File {
 
 	public static function getBytes( path : String ) : haxe.io.Bytes {
 		var f:python.lib.io.RawIOBase = cast python.lib.Builtin.open(path, "rb", -1);
-		var size = f.readall();
+		var size = f.read(-1);
 		var b = haxe.io.Bytes.ofData(size);
 		f.close();
 		return b;

+ 5 - 0
tests/unit/TestPython.hx

@@ -30,4 +30,9 @@ class TestPython extends Test {
 		var o:{function toLowerCase():String;} = "FOO";
 		eq("foo", o.toLowerCase());
 	}
+
+	public function testX() {
+		trace(sys.io.File.getBytes("res1.txt"));
+
+	}
 }