node_fn: Create a function to call a wrapped node.js package

Description Usage Arguments Details

View source: R/node_fn.R

Description

Use this function to create functions that call node.js module commands. The returned function will take arguments in the form of argument=value that are passed to the node module CLI as --argument=value.

Usage

1
2
3
node_fn(node_package, node_cmd = "", node_bin = node_package,
  r_package = environmentName(parent.frame()), node_dir = "node",
  return_list = TRUE, ...)

Arguments

node_package

the directory name of the node package

node_bin

the 'bin' command of the node package. Defaults to the package name

node_dir

the directory where node packages are kept. Defaults to 'node', which should be a directory under 'inst' when creaing your own package.

node_cmd

Optional. Command argument following the node binary, e.g., "init" in "dat init".

r_package

the package name which wraps the function. Defaults to the parent.frame, assuming that node_fn is being used in a package.

return_list

If TRUE, the new function will return a list of the return value, stdout, and stderr from the call to the node.js function. If FALSE, the new function will return the results of a system2 call.

...

Additional parameters to pass to system2 if return_list=FALSE

Details

The function will retrun a list comprised of output (0/1 for success/ failure), stdout, and stderr from the node command.


noamross/rnodejs documentation built on May 23, 2019, 9:31 p.m.