A variadic block that lets the user download one or more data frames as a
file in the browser. Intended as a lightweight counterpart to
new_write_block() for the common case where no server-side save is
needed.
Usage
new_download_block(filename = "", format = "csv", args = list(), ...)Arguments
- filename
Character. Optional fixed filename (without extension). If empty (default), a timestamped filename is generated.
- format
Character. One of the values in
write_formats():"csv","excel","parquet", or"feather". Default:"csv".- args
Named list of format-specific writing parameters (same as
new_write_block()). Only relevant values for the selected format are used.- ...
Forwarded to
blockr.core::new_transform_block().
Details
Multi-input behavior matches new_write_block(): multiple inputs produce
a multi-sheet Excel file for format = "excel", or a ZIP archive for CSV,
Parquet, and Feather.
Adding a new format (e.g. SAS) only requires extending
write_formats(), format_extension(), and the dispatch in
write_expr() - both new_write_block() and new_download_block()
pick it up automatically.
Examples
if (interactive()) {
library(blockr.core)
serve(new_download_block())
}