Skip to contents

Tool: Write a text file

Usage

btw_tool_files_write_text_file(path, content)

Arguments

path

Path to the file to write. The path must be in the current working directory.

content

The text content to write to the file. This should be the complete content as the file will be overwritten.

Value

Returns a message confirming the file was written.

Examples

withr::with_tempdir({
  btw_tool_files_write_text_file("example.txt", "Hello\nWorld!")
  readLines("example.txt")
})
#> [1] "Hello"  "World!"