[Rd] Using rawConnection() + gzfile() to obtain a raw vector of compressed data does not appear to work.
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Sun Sep 13 17:48:54 CEST 2026
В Sat, 12 Sep 2026 23:49:47 +0000
Pavel Krivitsky via R-devel <r-devel using r-project.org> пишет:
> In practice, the gzcon() actually modifies `compressed` in place,
> which is fine if it's a file or similar, but apparently
> rawConnectionValue() no longer works on it.
There's also another problem: gzcon buffers the compressed content
internally and only writes it into the underlying connection when the
buffer is full or when the connection is closed, but then there's no
valid connection to call rawConnectionValue() on. The feature request
with a candidate patch is now at
https://bugs.r-project.org/show_bug.cgi?id=19172.
> Am I using the wrong approach? Is there a workaround? memCompress()
> uses an incompatible format.
What's the intended use for the compressed buffer? In theory, it may be
possible to chop off the zlib header and construct the RFC1952 header
and trailer by hand, though CRC32 may be annoying to calculate.
--
Best regards,
Ivan
More information about the R-devel
mailing list