string repreesenting file path.
data to be written to file.
a fuction called when operation finished or an error occurred.
import std.file : exists, readText, remove; import dpromise.utils : runEventloop; writeAsyncWithCallback("hoge.txt", "hogehogepiyopiyo", (e) nothrow { try { assert(e is null); assert(exists("hoge.txt")); assert(readText("hoge.txt") == "hogehogepiyopiyo"); scope(exit) { remove("hoge.txt"); } } catch(Exception e) {} }); runEventloop();
Writes buffer to file path then calls the callback function with data as untyped array.
Creates a new file if it is not already exist. If an error occurred, the callback function will be called with the error.