-
Notifications
You must be signed in to change notification settings - Fork 13
API Documentation
In the table below, "Name String" refers to the term that you should provide as the -Z option for the wandiocat tool to produce compressed output in that particular format. The "Identifier" is the enumerated type that corresponds to the compression_type argument that must be provided when calling wandio_wcreate().
| Method | Name String | Identifier | Supports Read | Supports Write |
|---|---|---|---|---|
| No Compression | NA | WANDIO_COMPRESS_NONE | Yes | Yes |
| Gzip / Zlib | "gzip" | WANDIO_COMPRESS_ZLIB | Yes | Yes |
| Bzip2 | "bzip2" | WANDIO_COMPRESS_BZ2 | Yes | Yes |
| LZO | "lzo" | WANDIO_COMPRESS_LZO | No | Yes |
| LZMA (.xz) | "lzma" | WANDIO_COMPRESS_LZMA | Yes | Yes |
| zstd | "zstd" | WANDIO_COMPRESS_ZSTD | Yes | Yes |
| LZ4 | "lz4" | WANDIO_COMPRESS_LZ4 | Yes | Yes |
Note that support for each compression method is dependent on you having the appropriate development library installed on your system at compile time, e.g. LZ4 support is only available if liblz4-dev (or equivalent) is present on your system. If you've installed libwandio via a package, all of the supported methods will be available.
The following functions comprise the API for writing a (compressed) file using libwandio.
iow_t *wandio_wcreate(const char *filename, int compression_type, int compression_level, int flags);
Creates a new libwandio writer instance and opens the output file for writing.
Arguments:
-
filename-- the name of the output file to open -
compression_type-- the type of compression to be applied when writing to the file. Must be one of the "Identifier" values listed in the table at the top of this page. -
compression_level-- the compression level to use when writing to the file. This can range from 0 - 9 inclusive. 0 typically represents no compression. Larger values will often result in a better compression ratio, at the cost of requiring significantly more CPU time to run. Note that some compression methods do not support the use of levels to modify behaviour; in these cases, the value of the level does not matter. If you are unsure,1is a good starting point for the compression level. -
flags-- flags to apply when opening the file, just like those used byopen(2). Examples of flags would beO_CREATandO_DIRECTbut consult theopen(2)manpage for more information.
Returns a pointer to the new libwandio writer instance which will be required to call any of the other writing API functions.