unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Some help needed to use curl lib to download binary file
@ 2022-07-29  8:41 Sébastien Rey-Coyrehourcq
  2022-07-29 10:25 ` Vivien Kraus
  0 siblings, 1 reply; 3+ messages in thread
From: Sébastien Rey-Coyrehourcq @ 2022-07-29  8:41 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1.1: Type: text/plain, Size: 1276 bytes --]

Hi guile community,

I’m a new user, jumping into guix and guile in the same time,
i’m interested to build a module to download file stored on Zenodo platform, using curl to request their REST Api.

This is usefull for reproducibility, i need to recover some data from Zenodo before running guix package that compile simulation that use this data.

I built a first part, using some info i found about curl lib of guile, but i’m now blocked by the last part, writing the binary body retrieved by curl into some file on my disk.

Here the full script  on debian paste :  <https://paste.debian.net/1248702/>

My problem is probably here, i don’t know how to pass the byte of body (from (get-file get-file-link)) into some file, i try with and without “string->bytevector” body conversion, without success  :

;; report body content from url string
(define (get-file url)
  ((receive (response body) (http-get url #true) (string->bytevector body))))

;; write content into file
(call-with-output-file “download.zip” (lambda (current-output-port)
                                        (get-file get-file-link)
                                        (put-bytevector (current-output-port) body)))

Thanks for your help
Best regards,
S.RC.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 889 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-01  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29  8:41 Some help needed to use curl lib to download binary file Sébastien Rey-Coyrehourcq
2022-07-29 10:25 ` Vivien Kraus
2022-08-01  7:48   ` Sébastien Rey-Coyrehourcq

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).