read_file: Read an entire file

View source: R/read_file.R

read_fileR Documentation

Read an entire file

Description

read_file() reads an entire file into a single character vector. read_file_raw() reads an entire file into a raw vector.

Usage

read_file(path)

read_file_raw(path)

Arguments

path

A character string of the path to the file to read.

Details

read_file() assumes the file has a UTF-8 encoding.

Value

  • read_file(): A length 1 character vector.

  • read_file_raw(): A raw vector.

Examples

authors_file <- file.path(R.home("doc"), "AUTHORS")
data <- read_file(authors_file)
data_raw <- read_file_raw(authors_file)
identical(data, rawToChar(data_raw))

brio documentation built on May 29, 2024, 6:41 a.m.