Promise of untyped array of bytes read
import std.file : write, remove; import dpromise.utils : runEventloop; write("hoge.txt", "hogehogepiyopiyo"); scope(exit) remove("hoge.txt"); readAsync("hoge.txt").then( (data) { assert(data !is null); assert(cast(string)data == "hogehogepiyopiyo"); } ); readAsync("hoge.txt", 8).then( (data) { assert(data !is null); assert(cast(string)data == "hogehoge"); } ); 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.