rcloud.download.file {rcloud.support}R Documentation

Cause the browser to download a file

Description

rcloud.download.file invokes a file download in browsers that support it.

Usage

  rcloud.download.file(filename, content, mimetype)

Arguments

filename

string, name of the file as reported to the browser or if content is missing path to a file to send

content

string or raw binary content to put in the file. If not specified, the file specified by filename will be retrieved using readBin()

mimetype

optional string, a standard mime type to associate with the file, e.g. "text/plain" or "image/png". If missing, mime type will be inferred from the filename using mime::guess_type()

Details

rcloud.download.file sends a payload to the browser and causes the browser to download it under the specified filename.

If content is missing then filename is interpreted as a path to a file in the local filesystem whihc will be read as content and the name of the file is retained for the browser to use.

Note

Not all browsers allow invoking a download programmatically; in particular Safari may open the content in the same window. See https://github.com/eligrey/FileSaver.js/ for a list of compatibility issues.

Author(s)

Gordon Woodhull


[Package rcloud.support version 2.3-1 Index]