Skip to contents

str_read_lines() reads a text file in its entirety, converts it to UTF-8, and splits it at Unicode line boundaries.

Usage

str_read_lines(con, encoding = NULL)

Arguments

con

A file name or a connection opened in binary mode.

encoding

A single string giving the input encoding. NULL or "" uses the current default encoding.

Value

A character vector with one element per line.

See also

stringi::stri_read_lines() for the underlying implementation.

Examples

path <- tempfile()
writeLines(c("first", "second"), path, useBytes = TRUE)
str_read_lines(path, encoding = "UTF-8")
#> [1] "first"  "second"
unlink(path)