Skip to contents

text_read() and text_write() respectively wrap base::readLines() and base::writeLines(). They further validate their arguments, normalize file paths and re-encode inputs to UTF-8 before reading and writing.

Usage

text_read(path = "", encoding = "UTF-8")

text_write(x = character(), path = "", encoding = "UTF-8")

Arguments

path

A non-empty and non-NA character string. A path to a file to read text from, or write text to.

encoding

A non-empty and non-NA character string. The source character encoding. In almost all cases, this should be UTF-8. Other encodings are internally re-encoded to UTF-8 for portability.

x

A character vector. Lines of text to write. Its current encoding is given by encoding.

Value

text_read() returns a character vector.

text_write() returns NULL, invisibly.