Check to see if a file, or vector of files is compressed
isCompressed(path, type = c("zip", "gzip"), verbose = FALSE)
A logical
vector
Reads the first four bytes from the local file header.
If the file is a .ZIP file, this should match the magic number
PK\003\004
.
This function assumes that the first thing in a zip archive is the .ZIP entry with the local file header signature. ZIP files containing a self-extracting archive may not exhibit this structure and will return FALSE
# Get the files included with the package
fileDir <- system.file("extdata", package = "ngsReports")
allFiles <- list.files(fileDir, pattern = "zip$", full.names = TRUE)
isCompressed(allFiles)
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE