Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brentp/nim-gzfile

simple reader and writer for gzipped (and regular) files
https://github.com/brentp/nim-gzfile

gzip nim nim-lang zlib

Last synced: about 2 months ago
JSON representation

simple reader and writer for gzipped (and regular) files

Awesome Lists containing this project

README

        

this is a simple wrapper around your systems zlib.
it has an interface like nim's `File`.

```Nim
var gz: GZFile
if not gz.open(f, bufsize=16384):
quit "couldn't open file"
echo gz.tell
var line:string
while gz.readLine(line):
echo line

echo gz.error
echo gz.tell
gz.close

```

and writing:

```Nim
var wgz: GZFile
if not wgz.open(f, "w6"):
quit "couldn't open file"

for i in 0..10:
wgz.write("hello ", "big ")
wgz.write_line("world")
wgz.close
```

this works for both gzipped and regular files