1 import std.file : exists, readText, remove; 2 import dpromise.utils : runEventloop; 3 4 writeAsync("hoge.txt", "hogehogepiyopiyo").then({ 5 assert(exists("hoge.txt")); 6 assert(readText("hoge.txt") == "hogehogepiyopiyo"); 7 remove("hoge.txt"); 8 }); 9 10 runEventloop();
Writes buffer to file path with asynchronous IO.
Creates a new file if it is not already exist. If an error occurred, the promise will be rejected.