Code Plus icon

Code Plus

Run custom JavaScript with installable cached libraries

Code Plus

AI-generated

Summary

Execute custom JavaScript or Python code on input items with optional installation of required libraries and flexible run modes.

Inputs

  • Mode (required) — Select how the code executes: once for all input items, once for each input item, or in n8n Code node compatibility mode.
  • Language (required) — Choose the programming language to use for the code: JavaScript, Python (Beta), or Python Native (Beta).
  • Libraries — Specify libraries to install and cache, either as comma-separated package names/versions or as a JSON array.
  • Init Code — Optional initialization code run once before the main code, with declared variables accessible in main code.
  • JavaScript / Python Code (required) — Write your main code to manipulate input items and return modified or new items, adapted to the chosen language and run mode.
  • Options — Additional settings including cache directory, cache clearing, force reinstall, timeout for code execution, cache TTL for installed libraries, and option to install libraries without executing code.

Output shape

a list of items with JSON data, reflecting the output of the user-supplied code execution per selected run mode

The output items may include pairedItem metadata when running per item. Errors in initialization or main code can result in output items containing error details if 'Continue on Fail' is enabled, otherwise they cause node failure. Library installation errors also produce errors or fail the node. When 'Preinstall Only' option is set, no code runs and output indicates status and installed libraries.

Discussion