Defile.readFile

A covenience function that reads the entire content of a file in a single method call.

The method will first open for reading the file specified by filePath and determine its length. Then it will call the Defile.read method of the file instance, which will allocate or expand the provided buffer as necessary.

struct Defile
static
size_t
readFile
(
string filePath
,
ref ubyte[] buffer
)

Parameters

filePath
Type: string

The relative path to the file in the virtual file system.

buffer
Type: ubyte[]

The buffer in which the content of the file will be stored. The buffer will be allocated if null and expanded if too small.

Return Value

Type: size_t

The number of bytes read.

Throws

DefileException if an error occurs.

Meta