dpromise.utils.file

Provides implementation of file operation with asynchronous IO.

Members

Functions

readAsync
Promise!(void[]) readAsync(string path, size_t up_to = size_t.max)

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.

readAsyncWithCallback
void readAsyncWithCallback(string path, size_t up_to, void delegate(void[], Exception) nothrow callback)
void readAsyncWithCallback(string path, void delegate(void[], Exception) nothrow callback)

Read file path with asynchronous IO then calls the callback function. If file size is larger than up_to, only up_to bytes read.

readTextAsync
Promise!S readTextAsync(string path)

Read file path with asynchronous IO and return data read as a promise of string(validate with std.utf.validate)

readTextAsyncWithCallback
void readTextAsyncWithCallback(string path, void delegate(S, Exception) nothrow callback)

Read file path with asynchronous IO then calls the callback function with data as string(validate with std.utf.validate).

writeAsync
Promise!void writeAsync(string path, in void[] buffer)

Writes buffer to file path with asynchronous IO.

writeAsyncWithCallback
void writeAsyncWithCallback(string path, in void[] buffer, void delegate(Exception) nothrow callback)

Writes buffer to file path then calls the callback function with data as untyped array.

Meta