Buckets:

soixantesept's picture
download
raw
1.12 kB
// Minimal zpaq-stream extractor for the B6 payload.
// Mirror of the published dec.cpp minus the cmix preprocessor: just the one-shot
// libzpaq stream decoder (the exact API pair used by libzpaq::compress).
// Built with: g++ -Dunix -DNOJIT -Os ...
#include "libzpaq.h"
#include <stdio.h>
#include <stdlib.h>
void libzpaq::error(const char* msg) { fprintf(stderr, "zpaq: %s\n", msg); exit(1); }
class In : public libzpaq::Reader {
FILE* f;
public:
In(FILE* x) : f(x) {}
int get() { return getc(f); }
int read(char* b, int n) { return fread(b, 1, n, f); }
};
class Out : public libzpaq::Writer {
FILE* f;
public:
Out(FILE* x) : f(x) {}
void put(int c) { putc(c, f); }
void write(char* b, int n) { fwrite(b, 1, n, f); }
};
int main(int argc, char** argv) {
if (argc != 3) { fprintf(stderr, "usage: %s archive out\n", argv[0]); return 2; }
FILE* fi = fopen(argv[1], "rb");
if (!fi) { perror(argv[1]); return 1; }
FILE* fo = fopen(argv[2], "wb");
if (!fo) { perror(argv[2]); return 1; }
In in(fi);
Out out(fo);
libzpaq::decompress(&in, &out);
fclose(fi);
fclose(fo);
return 0;
}

Xet Storage Details

Size:
1.12 kB
·
Xet hash:
195bea37edbac095ba6b1e32b09e5366d1275405590f6463708afc393b9f1751

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.