Teaches blockr.io a file format at load time. The format then works
everywhere blockr.io's format knowledge is consulted: the read block's
dispatch, file_extensions() (and with it the file browser filter and
upload accept lists), and any package that asks the registry rather than
carrying its own extension list.
Arguments
- extensions
Character vector of file extensions (without dots).
- read
function(path, ...)returning an unevaluated expression that readspathinto a data frame. The expression may only call the reader package (e.g.bquote(your.pkg::read_special(.(path)))), never blockr....carries format options forwarded by the calling block.pathis a resolved location and may be a language object (a container splicing member reads against a run-time prefix), so splice it, do not inspect it.- options
Named list of format_opt specs declaring what
readaccepts through..., orNULLfor a format with nothing to tune. Blocks generate their settings fields from this and show no settings affordance at all when it is empty, so a format declaring options gets them offered everywhere without any block changing.- url_ok
Does this format's reader accept an
https://location where it accepts a path?readr's delimited readers do;readxlandarrowdo not. Blocks reading a URL download it to a temp file so that detection, size checks and a failed fetch all behave, and a format that declaresurl_ok = TRUEgets the URL back in the EXPRESSION it emits, so exported code names the source instead of a temp path that exists on one machine for one session. DefaultFALSE, which is the safe answer for a reader that cannot open a connection.
Details
Call from your package's .onLoad(). The registering namespace is
recorded automatically for collision messages. Registration never throws;
two packages claiming the same extension and mode error at first lookup,
naming both.