Skip to contents

Does the input contain a compressed file?

Usage

isCompressedFile(x)

isACompressedFile(x, nullOk = FALSE)

allAreCompressedFiles(x)

Arguments

x

Object.

nullOk

logical(1). If set to TRUE, x may also be NULL.

Value

TRUE on success; FALSE on failure, with cause set.

Details

Currently only performs a simple check, based on file extension match.

Functions

  • isCompressedFile(): Vectorized.

  • isACompressedFile(): Scalar.

  • allAreCompressedFiles(): Scalar.

Note

Updated 2023-09-29.

See also

Examples

## TRUE ====
x <- c("sample1.fastq.gz", "sample2.fastq.bz2")
invisible(file.create(x))
isCompressedFile(x)
#> [1] TRUE TRUE
unlink(x)

## FALSE ====
x <- c("sample1.fastq", "sample2.fastq")
invisible(file.create(x))
isCompressedFile(x)
#> [1] FALSE FALSE
unlink(x)