Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gemesa/libdeflate-nim
Nim wrapper for libdeflate.
https://github.com/gemesa/libdeflate-nim
libdeflate nim nim-lang nim-language nimble
Last synced: 3 days ago
JSON representation
Nim wrapper for libdeflate.
- Host: GitHub
- URL: https://github.com/gemesa/libdeflate-nim
- Owner: gemesa
- License: mit
- Created: 2023-01-12T14:22:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-11T12:14:24.000Z (about 1 year ago)
- Last Synced: 2023-10-11T18:56:47.488Z (about 1 year ago)
- Topics: libdeflate, nim, nim-lang, nim-language, nimble
- Language: Nim
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libdeflate-nim
libdeflate-nim is a very thin Nim wrapper for [libdeflate](https://github.com/ebiggers/libdeflate).## Deployment
### Prerequisites
The following tools are necessary for building:
- `nim` (1.6.10)
- `nimble` (0.13.1) (only if you want to install the package)
- C compiler (`gcc`, `clang`, etc.)### How to build
Invoke the following command to build the archive library:
```nim
$ nim c -d:release --app:staticlib -o:libdeflate.a libdeflate.nim
```Invoke the following command to build the shared object:
```nim
$ nim c -d:release --app:lib -o:libdeflate.so libdeflate.nim
```## Quickstart
*test.nim* contains a very basic code to demonstrate the usage of the libdeflate API. Invoke the following command to build and run it:
```nim
$ nim c -r -d:release test.nim
```
You should see a similar output:```nim
$ nim c -r -d:release test.nim
Hint: used config file '/.choosenim/toolchains/nim-1.6.10/config/nim.cfg' [Conf]
Hint: used config file '/.choosenim/toolchains/nim-1.6.10/config/config.nims' [Conf]
..........................................................
CC: adler32
CC: crc32
CC: deflate_compress
CC: deflate_decompress
CC: gzip_compress
CC: gzip_decompress
CC: utils
CC: zlib_compress
CC: zlib_decompress
CC: cpu_features
CC: ../../.choosenim/toolchains/nim-1.6.10/lib/std/private/digitsutils.nim
CC: ../../.choosenim/toolchains/nim-1.6.10/lib/system/assertions.nim
CC: ../../.choosenim/toolchains/nim-1.6.10/lib/system/dollars.nim
CC: ../../.choosenim/toolchains/nim-1.6.10/lib/system/io.nim
CC: ../../.choosenim/toolchains/nim-1.6.10/lib/system.nim
CC: libdeflate.nim
CC: test.nim
Hint: [Link]
Hint: gc: refc; opt: speed; options: -d:release
26779 lines; 2.385s; 31.57MiB peakmem; proj: /libdeflate-nim/test.nim; out: /libdeflate-nim/test [SuccessX]
Hint: /libdeflate-nim/test [Exec]
Input data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
Input data length: 101
Bound: 133Compressing data...
Compressed data: @[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 227, 226, 162, 3, 0, 0, 164, 97, 116, 73, 101, 0, 0, 0]
Compressed data length: 24Decompressing data...
Result: LIBDEFLATE_SUCCESS
Decompressed data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
Decompressed data length: 101
```