isCompressed: Check to see if a file is compressed

Description Usage Arguments Details Value Examples

View source: R/isCompressed.R

Description

Check to see if a file, or vector of files is compressed

Usage

1
isCompressed(path, type = c("zip", "gzip"), verbose = FALSE)

Arguments

path

The path to one or more files

type

The type of compression to check for. Currently only ZIP/GZIP files have been implemented.

verbose

logical/integer Determine the level of output to show as messages

Details

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

Value

A logical vector

Examples

1
2
3
4
# Get the files included with the package
fileDir <- system.file("extdata", package = "ngsReports")
allFiles <- list.files(fileDir, pattern = "zip$", full.names = TRUE)
isCompressed(allFiles)

ngsReports documentation built on Nov. 23, 2020, 2:01 a.m.