Generic implementing of how to download files from a connector:
ConnectorFS: Uses fs::file_copy()
to copy a file from the file storage
to the desired file
.
invisible connector_object.
# Download file from a file storage
folder <- withr::local_tempdir()
cnt <- connector_fs(folder)
cnt |>
write_cnt("this is an example", "example.txt")
#> Error: Cannot open file for writing:
#> * '/tmp/RtmpWV8S1R/fileb9b427e69e3fa/example.txt'
list.files(pattern = "example.txt")
#> character(0)
cnt |>
download_cnt("example.txt")
#> Error: [ENOENT] Failed to copy '/tmp/RtmpWV8S1R/fileb9b427e69e3fa/example.txt' to 'example.txt': no such file or directory
list.files(pattern = "example.txt")
#> character(0)
readLines("example.txt")
#> Warning: cannot open file 'example.txt': No such file or directory
#> Error in file(con, "r"): cannot open the connection
cnt |>
remove_cnt("example.txt")
#> Error: [ENOENT] Failed to remove '/tmp/RtmpWV8S1R/fileb9b427e69e3fa/example.txt': no such file or directory