unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: guile-user@gnu.org
Subject: Re: Guile-zstd 0.1.1 released
Date: Mon, 04 Jan 2021 18:21:19 +0100	[thread overview]
Message-ID: <87k0ssvcs0.fsf@gnu.org> (raw)
In-Reply-To: 8735zqfmte.fsf@web.de

Hi,

"Dr. Arne Babenhauserheide" <arne_bab@web.de> skribis:

> Looking at the readme I get the feeling that two little helpers could be
> useful:
>
>    (call-with-zstd-output-file "compressed.zstd"
> 	(lambda (port)
> 	  (define data
> 	    ;; Read the input file in memory.
> 	    (call-with-input-file "input-file.txt"
> 	      get-bytevector-all))
>
> 	  ;; Write data to PORT.
> 	  (put-bytevector port data)))
>
>   (call-with-zstd-input-file "compressed.zst"
> 	(lambda (port)
> 	  ;; Read decompressed data from PORT.
> 	  ...))
>
> Potentially with streaming added (if that’s possible from the library):
>
>    (call-with-zstd-output-file "compressed.zstd"
> 	(lambda (outport)
>       (call-with-input-file "input-file.txt"
> 	    (lambda (inport)
>           (let loop ((data (get-bytevector-some inport)))
>             (when (not (eof-object? data))
>               (put-bytevector outport data)
>               (loop (get-bytevector-some inport))))))))

Yeah I kept it minimal; it’s actually the same interface as in
Guile-zlib and Guile-lzlib, which is pretty convenient.

Thanks,
Ludo’.




  parent reply	other threads:[~2021-01-04 17:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27 14:01 Guile-zstd 0.1.0 released Ludovic Courtès
2020-12-27 15:00 ` Guile-zstd 0.1.1 released Ludovic Courtès
2020-12-28  6:48   ` Dr. Arne Babenhauserheide
2020-12-28  7:33     ` Guile ports Zelphir Kaltstahl
2021-01-04 17:21     ` Ludovic Courtès [this message]
2021-01-04 19:19   ` Guile-zstd 0.1.1 released Aleix Conchillo Flaqué

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0ssvcs0.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).