From |kry|ov @end|ng |rom d|@root@org  Thu Sep 12 16:27:37 2024
From: |kry|ov @end|ng |rom d|@root@org (Ivan Krylov)
Date: Thu, 12 Sep 2024 17:27:37 +0300
Subject: [Rd] Can gzfile be given the same method option as file
In-Reply-To: <CWXP123MB619012B710931D02CF91B812D0642@CWXP123MB6190.GBRP123.PROD.OUTLOOK.COM>
References: <CWXP123MB619012B710931D02CF91B812D0642@CWXP123MB6190.GBRP123.PROD.OUTLOOK.COM>
Message-ID: <20240912172737.1202b2bd@arachnoid>

? Thu, 12 Sep 2024 12:01:54 +0000
Simon Andrews via R-devel <r-devel at r-project.org> ?????:

> readRDS('https://seurat.nygenome.org/azimuth/references/homologs.rds')
> Error in gzfile(file, "rb") : cannot open the connection

I don't think that gzfile works with URLs. gzcon(), on the other hand,
does work with url() connections, which accepts the 'method' argument
and the getOption('url.method') default.

h <- readRDS(url(
 'https://seurat.nygenome.org/azimuth/references/homologs.rds'
))

But that only works with gzip-compressed files. For example, CRAN's
PACKAGES.rds is xz-compressed, and I don't see a way to read it the
same way:

readBin(
 index <- file.path(
  contrib.url(getOption('repos')['CRAN']),
  'PACKAGES.rds'
 ), raw(), 5
) |> rawToChar()
# [1] "\xfd7zXZ" <-- note the "7zXZ" header
readRDS(url(index))
# Error in readRDS(url(index)) : unknown input format

>   2.  Given the warnings we're getting when using wininet, are their
> plans to make windows certficates be supported in another way?

What does libcurlVersion() return for you? In theory, it should be
possible to make libcurl use schannel and therefore the system
certificate store for TLS verification purposes.

-- 
Best regards,
Ivan



[Rd] Can gzfile be given the same method option as file
Ivan Krylov