From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?S=C3=A9bastien?= Rey-Coyrehourcq Newsgroups: gmane.lisp.guile.user Subject: Some help needed to use curl lib to download binary file Date: Fri, 29 Jul 2022 10:41:50 +0200 Message-ID: <874jz01erv.fsf@univ-rouen.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="====-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36443"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.11; emacs 28.1.90 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Jul 29 10:54:18 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oHLlC-0009HO-FE for guile-user@m.gmane-mx.org; Fri, 29 Jul 2022 10:54:18 +0200 Original-Received: from localhost ([::1]:43502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHLlA-0007fA-R5 for guile-user@m.gmane-mx.org; Fri, 29 Jul 2022 04:54:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHLkE-0007dc-FQ for guile-user@gnu.org; Fri, 29 Jul 2022 04:53:18 -0400 Original-Received: from smtp-out-2.univ-rouen.fr ([193.52.152.97]:40286 helo=mailhoc.univ-rouen.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHLkB-0007Cn-VW for guile-user@gnu.org; Fri, 29 Jul 2022 04:53:18 -0400 Original-Received: from localhost (i16-les01-ix2-62-35-41-231.sfr.lns.abo.bbox.fr [62.35.41.231]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailhoc.univ-rouen.fr (Postfix) with ESMTPSA id 637D62170 for ; Fri, 29 Jul 2022 10:53:10 +0200 (CEST) X-Spamd-Bar: -- Authentication-Results: ORIGINATING; auth=pass smtp.auth=reycoseb smtp.mailfrom=sebastien.rey-coyrehourcq@univ-rouen.fr X-Rspamd-Server: mailhoc X-Rspamd-Queue-Id: 637D62170 X-Spamd-Result: default: False [-2.20 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,multipart/alternative,text/plain]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM(-0.00)[-0.765,0]; SIGNED_PGP(-2.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:+,5:~,6:~]; ASN(0.00)[asn:5410, ipnet:62.34.0.0/15, country:FR]; MID_RHS_MATCH_FROM(0.00)[] Received-SPF: pass client-ip=193.52.152.97; envelope-from=sebastien.rey-coyrehourcq@univ-rouen.fr; helo=mailhoc.univ-rouen.fr X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL=1.31, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18463 Archived-At: --====-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: multipart/mixed; boundary="==-=-=" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi guile community, I=E2=80=99m a new user, jumping into guix and guile in the same time, i=E2=80=99m 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 Zenod= o 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=E2=80=99m 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 : My problem is probably here, i don=E2=80=99t know how to pass the byte of b= ody (from (get-file get-file-link)) into some file, i try with and without = =E2=80=9Cstring->bytevector=E2=80=9D 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 =E2=80=9Cdownload.zip=E2=80=9D (lambda (current-outp= ut-port) (get-file get-file-link) (put-bytevector (current-output-por= t) body))) Thanks for your help Best regards, S.RC. --==-=-=-- --=-=-=-- --====-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJcBAEBCABGFiEEQdBRWS1ZqcB6tN8l3FXLa3BDQW4FAmLjn/QoHHNlYmFzdGll bi5yZXktY295cmVob3VyY3FAdW5pdi1yb3Vlbi5mcgAKCRDcVctrcENBbtubD/0Y UOJcbUgIyQMXzpCZ8VDLNjI/2ZPkE6j0d6GbwF6uL/f16p3ykAKahdcgMYf58Li9 GdjVECBi4NEmqx/y76Yqzt2fIUBh7fzwlDqt+V3av3rajl5qP64WJ5Ezpfhp3BKJ szuYUej372vx3mHZ1oRaCUyqAx5xAd/T2z531p+IGJsJTVRQqxzXRKm9ILxkh03t MM8OWPJR4rEsE6aumUl8FLAW/iu5+kKa3EOwQDZAK4v46uLTUB4VPzSDpdeAjW2L zksx5r2EuHgTpai0cTp8MacdrSIeZGcJeYwtXgy48WNXn5y+UWXPxQsRQCZm+HJp gogEG67PpAQaSKvOPcEz6DIk3qLDgM6XBI4qKkwXbuZw/ozv4kKq6o1ofA/7M/7v RCDPcP+7b4oRrsXlUGzsKL0hQqNyzDK4Zz+ZK1MXPnBD7erWFIZH+X7/8PxESwKs kgZrHchNvBLV98LYNEyGMAxLTX08OTrZi6Hfn8M2MMRZY7ziGgpaygaiKG3b47ep DEQnmUgvLrImczMag8bVl881qIBl2Fb3aH3CVtZx22U4qa0yPSkxTaLqhjZ41Hnp u0EXIiUGote79EjB/YbOGyHTwP3kOolHk+OlsHE5kkZLynbSoVYyG4fybOgEwWeI dSduBcETIIW48p2q9F7C7uyR1E+8SIbmTCKcU6QFhw== =Lc2/ -----END PGP SIGNATURE----- --====-=-=--