vol_standalone: Carry a payload inside one HTML file

View source: R/standalone.R

vol_standaloneR Documentation

Carry a payload inside one HTML file

Description

Inlines a payload into the viewer page, so that the result opens from a local file with no server and travels as a single attachment.

Usage

vol_standalone(payload, path = NULL, viewer = NULL, manifest = NULL)

Arguments

payload

A vol_payload, or the path of a payload directory.

path

Destination file. Defaults to a file named after the template, volume_viewer_standalone.html, in the session's temporary directory.

viewer

The page template to inline into. Defaults to the copy the package ships.

manifest

The manifest to embed. Taken from payload when it is a vol_payload.

Details

Carry a payload inside one HTML file

A page served over http fetches its images. The same page opened from disk cannot, because a browser refuses a cross-origin read from a local file, so this build carries every image as a data URI instead, at the cost of the third that base64 adds. For the case study at its native grid the directory is 1.5 MB and the single file 2.07 MB.

The splice works on bytes and not on lines, so the accented characters of the page and its line endings pass through untouched, and the block goes in immediately before the script that reads it.

Value

The path written, invisibly.

See Also

vol_payload() for the payload, vol_widget() for the same renderer inside shiny, shinyVolumr() for the application that drives the whole workflow.

Examples

out <- vol_standalone(vol_example_payload(),
                      path = file.path(tempdir(), "med.html"))
file.size(out)
if (interactive()) utils::browseURL(out)

volumr documentation built on Dec. 2, 2026, 5:07 p.m.