Convert Coding Nodes
Most Convert Nodes have intuitive inputs that are covered by the Nodes documentation.
There are a few exceptions that require further explanation:
JavaScript Node SDK
For advanced documentation on this topic - click here.
The JavaScript Code Node
allows you to run custom scripts in your Convert Workflow. They have a minimal code editor available in the properties pane.
When a JavaScript Node is executed inside a Workflow, the run
function will be triggered.
This function will take the input
and sdk
input parameters:
export function run(input, sdk) {
let parsed = sdk.asString(input);
sdk.console.log(parsed);
return parsed;
}
The sdk
parameter is an object that supplies various functionality for the Caido JS Node SDK.
INFO
Below you will find a summary of its various functions, but for now, just know that sdk.console.log()
is a way to output data for debugging to the Caido Log File.
The input
object is a BytesInput
object, which is essentially an array of number
objects which represent the Unicode codepoints of the selected text over each index of the user supplied input.
For example:
export function run(input, sdk) {
sdk.console.log(input)
...
}
Where the selected input was aaa
will result in:
2024-05-26T12:14:13.115630Z INFO executor:0|arbiter:3 JsSdk: [ 97, 97, 97 ]
being outputed to the backend logs since the Unicode codepoint for a
is 97
.
In order to get the String
version of the input, we use the sdk.asString
function which will convert each byte of the array into its String character conterpart:
let parsed = sdk.asString(input);
From there you can perform various operations on the input.
TIP
Additional functionality of sdk
:
sdk.asString
- convertBytesInput
object to String.sdk.console
- access to JS console functionality.sdk.console.log
- log data to the console.sdk.console.warn
- log warning data to the console.sdk.console.debug
- log debug data to the console.sdk.console.error
- log error data to the console.sdk.console.requests
- access to the SDK for the Requests service.sdk.console.requests.inScope
- determine whether the current request is in scope or not
Shell Node
The Shell Node
allows you to call external programs in the Workflow.
Depending on the platform on which Caido is running (Unix/Windows/MacOS) you will have access to different shells:
- Select your shell from the drop-down menu.
- For some shells, Caido will try to source the default
.[shell]rc
file in your home directory. If that doesn't work for you, you can manually override theInit
.
Data is received via STDIN
and is expected to output on STDOUT
. The STDERR
will be printed in the backend logs. The command should also exit with 0
.
TIP
If you're running Caido on Windows and you'd like to call out to WSL for the shell node, use the following to trigger in the WSL environment:
wsl -- YOUR_COMMAND
Control Flow Nodes
Control Flow Nodes allow you to take various paths based on conditions.
If/Else Node
The If/Else Node
can split the Workflow into two paths of action - based on the Boolean evalutation of a previous Node.
If/Else JavaScript Node
The If/Else Javascript
Node is very similar to the JavaScript Code Node
, with the exception that it must return a Boolean value.
export function run(input, sdk) {
return false;
}
INFO
The development of Nodes will be ongoing and new nodes will be included in future Caido releases.