ArzCreator

this class can be used to create archive file.

version(WithArczCode)
final
class ArzCreator {}

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Examples

import std.file, std.path, std.stdio : File;

enum ArcName = "z00.arz";
enum DirName = "experimental-docs";

ubyte[] rdbuf;
rdbuf.length = 65536;

auto arcz = new ArzCreator(ArcName);
long total = 0;
foreach (DirEntry e; dirEntries(DirName, SpanMode.breadth)) {
  if (e.isFile) {
    assert(e.size < uint.max);
    //writeln(e.name);
    total += e.size;
    string fname = e.name[DirName.length+1..$];
    arcz.newFile(fname, cast(uint)e.size);
    auto fi = File(e.name);
    for (;;) {
      auto rd = fi.rawRead(rdbuf[]);
      if (rd.length == 0) break;
      arcz.rawWrite(rd[]);
    }
  }
}
arcz.close();
writeln(total, " bytes packed to ", getSize(ArcName), " (", arcz.chunksWritten, " chunks, ", arcz.filesWritten, " files)");

Meta