Learn R Programming

freesurferformats (version 1.1.0)

is.gzip.file: Check whether a file is gzip-compressed, based on its magic bytes.

Description

Uses the gzip magic number (0x1f 0x8b) rather than the file extension, since files are regularly renamed or stripped of their extension. Reading a gzip-compressed payload from a plain file() connection silently produces garbage.

Usage

is.gzip.file(filepath)

Value

logical, TRUE if the file starts with the gzip magic number.

Arguments

filepath

character string, path to the file to check.