View Source NodeJS (NodeJS v3.2.0)
Summary
Functions
Calls a Node.js function. Returns {:ok, result} if the call is successful, or {:error, reason} if the call fails.
Calls a Node.js function. Returns the result if the call is successful, or raises NodeJS.Error.
Functions
Calls a Node.js function. Returns {:ok, result} if the call is successful, or {:error, reason} if the call fails.
Options
:timeout(optional): The timeout (in milliseconds) for the call. Defaults to 30 seconds.:esm(optional): Whether to load the module as ESM. Defaults totruewhen the module filename ends in.mjs, otherwisefalse.:binary(optional): Whether to return the response in binary form. Defaults to false.
Examples
> NodeJS.call({"markdown-renderer.js", :renderHTML}, [inputMarkdown], esm: true)
{:ok, "<html>...</html>"}
Calls a Node.js function. Returns the result if the call is successful, or raises NodeJS.Error.
Options
See call/3 for options.
Example
> NodeJS.call!({"markdown-renderer.js", :renderHTML}, [inputMarkdown], esm: true)
"<html>...</html>"