string repreesenting file path.
max buffer size. default value is size_t.max.
Promise of untyped array of bytes read
1 import std.file : write, remove; 2 import dpromise.utils : runEventloop; 3 4 write("hoge.txt", "hogehogepiyopiyo"); 5 scope(exit) remove("hoge.txt"); 6 7 readAsync("hoge.txt").then( 8 (data) { 9 assert(data !is null); 10 assert(cast(string)data == "hogehogepiyopiyo"); 11 } 12 ); 13 14 readAsync("hoge.txt", 8).then( 15 (data) { 16 assert(data !is null); 17 assert(cast(string)data == "hogehoge"); 18 } 19 ); 20 21 runEventloop();
Read file path with asynchronous IO and returns data read as a promise of untyped array. If file size is larger than up_to, only up_to bytes read.
If an error occurred, the promise will be rejected.