isCompressed: Check to see if a file is compressed

View source: R/isCompressed.R

isCompressedR Documentation

Check to see if a file is compressed

Description

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

Usage

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


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


steveped/ngsReports documentation built on April 2, 2024, 5:10 p.m.