Skip to content

Commit

Permalink
tweaks after adding zstd support
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87616 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Jan 22, 2025
1 parent 6e6f6ba commit e14a1ec
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/library/base/man/memCompress.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% File src/library/base/man/memCompress.Rd
% Part of the R package, https://www.R-project.org
% Copyright 2009-2023 R Core Team
% Copyright 2009-2025 R Core Team
% Distributed under GPL 2 or later

\name{memCompress}
Expand Down Expand Up @@ -56,9 +56,9 @@ memDecompress(from,
\eqn{2^{31}-1}{2^31 - 1} elements. Compression is equivalent to
\command{bzip2 -9} (the default).

\command{zstd} compression is optional and currently uses compression
level 3 which gives a good compression ratio vs compression speed
trade-off.
\command{zstd} compression was introduced in \R 4.5.0: it is an
optional part of the \R build and currently uses compression level 3
which gives a good compression ratio vs compression speed trade-off.

Compressing with \code{type = "xz"} is equivalent to compressing a
file with \command{xz -9e} (including adding the \sQuote{magic}
Expand Down
15 changes: 9 additions & 6 deletions src/library/base/man/readRDS.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% File src/library/base/man/serialize.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2021 R Core Team
% Copyright 1995-2025 R Core Team
% Distributed under GPL 2 or later

\name{readRDS}
Expand All @@ -20,18 +20,18 @@ infoRDS(file)
}
\arguments{
\item{object}{\R object to serialize.}
\item{file}{a \link{connection} or the name of the file where the \R object
is saved to or read from.}
\item{file}{a \link{connection} or the path name of the file where the
\R object is saved to or read from.}
\item{ascii}{a logical. If \code{TRUE} or \code{NA}, an ASCII
representation is written; otherwise (default), a binary one is used.
See the comments in the help for \code{\link{save}}.}
\item{version}{the workspace format version to use. \code{NULL}
specifies the current default version (3). The only other supported
specifies the current default version (3). The only other supported
value is 2, the default from \R 1.4.0 to \R 3.5.0.}
\item{compress}{a logical specifying whether saving to a named file is
to use \code{"gzip"} compression, or one of \code{"gzip"},
\code{"bzip2"} or \code{"xz"} to indicate the type of compression to
be used. Ignored if \code{file} is a connection.}
\code{"bzip2"}, \code{"xz"} or \code{"zstd"} to indicate the type of
compression to be used. Ignored if \code{file} is a connection.}
\item{refhook}{a hook function for handling reference objects.}
}
\details{
Expand Down Expand Up @@ -97,6 +97,9 @@ infoRDS(file)
machines, for example to download from a website. The
files produced by \code{\link{save}} have a header identifying the
file type and so are better protected against erroneous use.

\code{compress = "zstd"} was first supported in \R 4.5.0, and needs OS
support so is even less suited as an interchange format.
}

\seealso{
Expand Down
12 changes: 8 additions & 4 deletions src/library/base/man/save.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% File src/library/base/man/save.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2020 R Core Team
% Copyright 1995-2025 R Core Team
% Distributed under GPL 2 or later

\name{save}
Expand Down Expand Up @@ -50,7 +50,7 @@ save.image(file = ".RData", version = NULL, ascii = FALSE,
\item{compress}{logical or character string specifying whether saving
to a named file is to use compression. \code{TRUE} corresponds to
\command{gzip} compression, and character strings \code{"gzip"},
\code{"bzip2"} or \code{"xz"} specify the type of
\code{"bzip2"}, \code{"xz"} or \code{"zstd"} specify the type of
compression. Ignored when \code{file} is a connection and
for workspace format version 1.}
\item{compression_level}{integer: the level of compression to be
Expand Down Expand Up @@ -180,12 +180,16 @@ save.image(file = ".RData", version = NULL, ascii = FALSE,
vectors, external pointers and some S4 objects).

One such \sQuote{later addition} was \link{long vectors}, introduced in \R
3.0.0 and loadable only on 64-bit platforms.
3.0.0 and loadable only on 64-bit platforms (32-bit platforms are
dperecated but still supported).

Loading files saved with \code{ASCII = NA} requires a C99-compliant C
function \code{sscanf}: this is a problem on Windows, first worked
function \code{sscanf}: this was a problem on Windows, first worked
around in \R 3.1.2: version-2 files in that format should be readable
in earlier versions of \R on all other platforms.

\code{compress = "zstd"} was first supported in \R 4.5.0 and needs
(optional) OS support so is not recommended as an interchange format.
}
\seealso{
\code{\link{dput}}, \code{\link{dump}}, \code{\link{load}},
Expand Down
2 changes: 1 addition & 1 deletion src/library/tools/man/writePACKAGES.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ write_PACKAGES(dir = ".", fields = NULL,
are used.
}
\item{type}{
Type of packages: currently source \file{.tar.\{gz,bz2,xz\}} archives,
Type of packages: currently source \file{.tar.\{gz,bz2,xz,zstd\}} archives,
and macOS or Windows binary (\file{.tgz} or \file{.zip},
respectively) packages are supported. Defaults to
\code{"win.binary"} on Windows and to \code{"source"} otherwise.
Expand Down
6 changes: 3 additions & 3 deletions src/library/utils/R/packages2.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ install.packages <-
get_package_name <- function(pkg) {
## Since the pkg argument can be the name of a file rather than
## a regular package name, we have to clean that up.
gsub("_[.](zip|tar[.]gz|tar[.]bzip2|tar[.]xz)", "",
gsub("_[.](zip|tar[.](gz|bzip2|bz2|xz|zstd|xst))", "",
gsub(.standard_regexps()$valid_package_version, "",
basename(pkg)))
}
Expand Down Expand Up @@ -399,7 +399,7 @@ install.packages <-
df <- function(p, destfile, method, ...)
download.file(p, destfile, method, mode = "wb", ...)
urls <- unique(pkgs[web])

if (missing(method) || method == "auto" || method == "libcurl") {
# bulk download using libcurl
destfiles <- file.path(tmpd, basename(urls))
Expand All @@ -417,7 +417,7 @@ install.packages <-
} else
pkgs[web] <- destfiles
} else
pkgs[web] <- NA
pkgs[web] <- NA
} else {
# serial download
for (p in urls) {
Expand Down

0 comments on commit e14a1ec

Please sign in to comment.