brio
brio copied to clipboard
Basic R Input Output
Base's `writeLines()` has a default value for con: ``` writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE) ``` Which can cause errors if brio is used as a...
that handles UTF-8 files correctly on Windows? See discussion at https://github.com/tidyverse/dplyr/issues/2471#issuecomment-369386287.
Might be out of scope, but doing it in base R is rather fiddly: https://github.com/gaborcsardi/rencfaq#how-to-parse-utf-8-text-into-utf-8-code
https://github.com/r-lib/brio/blob/07de917a99d1f10626a431ad124ca71e33b43d60/src/read_lines.c#L136 I see the comment about mentions xlengthgets: https://github.com/r-lib/brio/blob/07de917a99d1f10626a431ad124ca71e33b43d60/src/read_lines.c#L133 And also the previous implementation used xlength: https://github.com/r-lib/brio/blob/c157ff766c307756b43032a62c5aa0136f5da65c/src/read_lines.c#L133 So I wonder if the comment is wrong, or if xlengthgets was intended.
If `TRUE` output will be appended to file; otherwise, it will overwrite the contents of file.
``` r brio::read_file("doesn'texist") #> Error in normalizePath(path, mustWork = TRUE): path[1]="doesn'texist": No such file or directory ``` Created on 2025-08-04 with [reprex v2.1.1](https://reprex.tidyverse.org)