From enc v0.2.0
0th

Percentile

This function is a drop-in replacement for readLines() from disk files. It always returns text in the UTF-8 encoding and never warns on missing EOL on the last line.

try_read_lines_enc() is a variant that returns an empty character vector on error, with a warning.

Usage
read_lines_enc(path, file_encoding = "UTF-8", n = -1L, ok = TRUE,
skipNul = FALSE)try_read_lines_enc(path, file_encoding = "UTF-8", n = -1L, ok = TRUE,
skipNul = FALSE)
Arguments
path

Path to the file

file_encoding

The encoding to assume for the input file.

n

integer. The (maximal) number of lines to read. Negative values indicate that one should read up to the end of input on the connection.

ok

logical. Is it OK to reach the end of the connection before n > 0 lines are read? If not, an error will be generated.

skipNul

logical: should nuls be skipped?

readr::read_lines() for a faster alternative.
Other file functions: transform_lines_enc, write_lines_enc