copy

Copy algorithm do not transform data at all This is useful in cases of reading/writing data that may or may not be compressed. Using Copy allows that the same code handles both kind of streams.

copy
(
I
)

Examples

import test.util : generateRepetitiveData;
import std.array : join;

const len = 10_000;
const phrase = cast(const(ubyte)[]) "Some very repetitive phrase.\n";
const input = generateRepetitiveData(len, phrase).join();

/// copying with arbitrary chunk sizes on input and output
const cop1 = generateRepetitiveData(len, phrase, 1231).copy(234).join();
const cop2 = generateRepetitiveData(len, phrase, 296).copy(6712).join();

assert(input == cop1);
assert(input == cop2);

Meta