These functions cover a large area of potential response body formats. They are all registered to their standard mime type but users may want to use them to register them to alternative types if they know it makes sense.
Usage
format_csv(...)
format_tsv(...)
format_rds(version = "3", ascii = FALSE, ...)
format_geojson(...)
format_feather(...)
format_parquet(...)
format_yaml(...)
format_htmlwidget(...)
format_format(..., sep = "\n")
format_print(..., sep = "\n")
format_cat(..., sep = "\n")
format_unboxed(...)
format_png(...)
format_jpeg(...)
format_tiff(...)
format_svg(...)
format_bmp(...)
format_pdf(...)Arguments
- ...
Further argument passed on to the internal formatting function. See Details for information on which function handles the formatting internally in each serializer
- version
the workspace format version to use.
NULLspecifies the current default version (3). The only other supported value is 2, the default from R 1.4.0 to R 3.5.0.- ascii
a logical. If
TRUEorNA, an ASCII representation is written; otherwise (default) a binary one. See also the comments in the help forsave.- sep
The separator between multiple elements
Provided serializers
format_csv()usesreadr::format_csv()for formatting. It is registered as"csv"to the mime typetext/csvformat_tsv()usesreadr::format_tsv()for formatting. It is registered as"tsv"to the mime typetext/tsvformat_rds()usesserialize()for formatting. It is registered as"rds"to the mime typeapplication/rdsformat_geojson()usesgeojsonsf::sfc_geojson()orgeojsonsf::sf_geojson()for formatting depending on the class of the response body. It is registered as"geojson"to the mime typeapplication/geo+jsonformat_feather()usesarrow::write_feather()for formatting. It is registered as"feather"to the mime typeapplication/vnd.apache.arrow.fileformat_parquet()usesnanoparquet::write_parquet()for formatting. It is registered as"parquet"to the mime typeapplication/vnd.apache.parquetformat_yaml()usesyaml::as.yaml()for formatting. It is registered as"yaml"to the mime typetext/yamlformat_htmlwidget()useshtmlwidgets::saveWidget()for formatting. It is registered as"htmlwidget"to the mime typetext/htmlformat_format()usesformat()for formatting. It is registered as"format"to the mime typetext/plainformat_print()usesprint()for formatting. It is registered as"print"to the mime typetext/plainformat_cat()usescat()for formatting. It is registered as"cat"to the mime typetext/plainformat_unboxed()usesreqres::format_json()withauto_unbox = TRUEfor formatting. It is registered as"unboxedJSON"to the mime typeapplication/json
Additional registered serializers
reqres::format_json()is registered as "json" to the mime typeapplication/jsonreqres::format_html()is registered as "html" to the mime typetext/htmlreqres::format_xml()is registered as "xml" to the mime typetext/xmlreqres::format_plain()is registered as "text" to the mime typetext/plain
Provided graphics serializers
Serializing graphic output is special because it requires operations before
and after the handler is executed. Further, handlers creating graphics are
expected to do so through side-effects (i.e. call to graphics rendering) or
by returning a ggplot2 object. If you want to create your own graphics
serializer you should use device_formatter() for constructing it.
format_png()usesragg::agg_png()for rendering. It is registered as"png"to the mime typeimage/pngformat_jpeg()usesragg::agg_jpeg()for rendering. It is registered as"jpeg"to the mime typeimage/jpegformat_tiff()usesragg::agg_tiff()for rendering. It is registered as"tiff"to the mime typeimage/tiffformat_svg()usessvglite::svglite()for rendering. It is registered as"svg"to the mime typeimage/svg+xmlformat_bmp()usesgrDevices::bmp()for rendering. It is registered as"bmp"to the mime typeimage/bmpformat_pdf()usesgrDevices::pdf()for rendering. It is registered as"pdf"to the mime typeapplication/pdf