std.zip for Binary example

locco via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 17 02:34:19 PST 2016


Hi :)
I found this example:
======================================================================
import std.file: write;
import std.string: representation;
void main()
{
    char[] data = "Test data.\n".dup;
    // Create an ArchiveMember for the test file.
    ArchiveMember am = new ArchiveMember();
    am.name = "test.txt";
    am.expandedData(data.representation);
    // Create an archive and add the member.
    ZipArchive zip = new ZipArchive();
    zip.addMember(am);
    // Build the archive
    void[] compressed_data = zip.build();
    // Write to a file
    write("test.zip", compressed_data);
}
======================================================================
But i cound't find example code for binary file.
How can i make ArciveMember for binary file?


More information about the Digitalmars-d-learn mailing list