Optionally, setup a locker storage space on disk with a specific file
format (e.g. fst or feather).
Usage
file_stream(
n,
locker = NULL,
format = NULL,
where = NULL,
ask = FALSE,
noreset = FALSE,
...
)Arguments
- n
The number of file names to generate; must be a single numeric value greater than or equal to 1.
- locker
Passed to
setup_locker()asdir; important to note that the directory will be unlinked if it exists and is an established locker directory.- format
Passed to
format_stream().- where
An optional file path; this is replaced by
lockerif it is also passed.- ask
If
TRUE, thenconfig_locker()will be called on the locker space; once this is called, all future attempts to reset the locker contents will require user confirmation viautils::askYesNo(); theaskrequirement can be revoked by callingconfig_locker().- noreset
If
TRUEthenconfig_locker()will be called on the locker directory withnoreset = TRUEto prevent future resets; note that this is essentially a dead end; there is no way to make the locker space writable using public api; use this option if you really want to safeguard the output and assume complete control over the fate of these files.- ...
Additional arguments passed to
file_set().
Details
The user is encouraged to read the documentation and understand the ask
and noreset arguments. These may be important tools for you to use to
ensure the safety of outputs stored in locker space.
Pass locker to set up locker space for saving outputs; this involves
clearing the locker directory (see setup_locker() for details). Passing
locker also sets the path for output files. If you want to set up the path
for output files without setting up locker space, pass where.
Examples
x <- file_stream(3, locker = temp_ds("foo"), format = "fst")
x[[1]]
#> $i
#> [1] 1
#>
#> $file
#> [1] "/var/folders/5w/2ky5lwcj1zq7kyk4c3zg3zpw0000gp/T//Rtmpx1IZit/foo/1-3.fst"
#>
#> attr(,"file_set_item")
#> [1] TRUE
#> attr(,"class")
#> [1] "stream_format_fst" "list"