[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Some help needed to use curl lib to download binary file
From: |
Sébastien Rey-Coyrehourcq |
Subject: |
Some help needed to use curl lib to download binary file |
Date: |
Fri, 29 Jul 2022 10:41:50 +0200 |
User-agent: |
mu4e 1.6.11; emacs 28.1.90 |
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.
signature.asc
Description: PGP signature
- Some help needed to use curl lib to download binary file,
Sébastien Rey-Coyrehourcq <=