Path.appendFile

Append data to file as is

struct Path
@safe const
void
appendFile
(
in void[] buffer
)

Parameters

buffer void[]

untypes array to write to file.

Throws

FileException in case of error

Examples

import dshould;
Path root = createTempPath();
scope(exit) root.remove();

ubyte[] data = [1, 7, 13, 5, 9];
ubyte[] data2 = [8, 17];
root.join("test-write-2.txt").exists.should.be(false);
root.join("test-write-2.txt").writeFile(data);
root.join("test-write-2.txt").appendFile(data2);
root.join("test-write-2.txt").exists.should.be(true);
ubyte[] rdata = cast(ubyte[])root.join("test-write-2.txt").readFile;
rdata.length.should.equal(7);
rdata[0].should.equal(1);
rdata[1].should.equal(7);
rdata[2].should.equal(13);
rdata[3].should.equal(5);
rdata[4].should.equal(9);
rdata[5].should.equal(8);
rdata[6].should.equal(17);

Meta