JavaScriptJS
This mod extends KubeJS functionality by adding additional capabilities for working with JSON and JavaScript files. The extension significantly simplifies reading, writing, and file management processes when working with modifications.
JsonIO Extension
Two important methods have been added for working with JSON files in KubeJS:
- writeAndCreateDirectories - Automatically creates parent directories when saving JSON files, preventing write errors
- findJsonInDirectory - Allows finding the paths to all JSON files in a specified directory
New JSIO System
The mod also introduces a comprehensive JSIO system for working with JavaScript files:
- getAllowSuffix - Checks allowed file extensions for various operations
- read - Reads file contents and returns them as a list of strings
- exists - Checks if the specified file exists
- write - Writes data to a file with automatic creation of necessary directories
- delete - Deletes the specified file
- findJSInDirectory - Finds all JavaScript files in a given directory
This modification is particularly useful for developers working with custom scripts and settings in KubeJS.