The LZ4F decompression API does not expose/implement functions to that allow to decompress up to 'size' bytes. This project implements such functions.
It was needed in another project of mine to implement functions similar to fread(), fgets(), fgetc, gzread(), gzgets(), gzgetc(). The LZ4F API does not implement this functionality.
This projects provides a similar API around an opaque struct, Cfp. The main functions are
- cfopen(), to open a file for decompressing
- cfclose(), when done decompressing
- cfread(), to get up to size decompressed bytes in a provided buffer, similar to fread()
- cfgets(), to get a NULL terminated string up to new line or up to size, similar to fgets()
- cfgetc(), to get a decompressed byte, similar to fgetc()
- Linux/Unix
- gcc
- lz4 library
- make
- diff (for tests)
- valgrind, gcc (for debugging)
To compile and install in ./build simply run make
make
To run some rundimentary tests run
make check
To clean up
make clean
For help run
./build/lz4_decompress_size h
For example, to decompress file 'foo' using the fgets equivalent use:
./build/lz4_decompress_size l foo
Georgios
- 0.1
- Initial Release
This project is licensed under the BSD License - see the LICENSE.md file for details
The testing file was taken from postgres source. The LZ4F implementation can be found in github.