Core
Contains common utilities. All functions here are also available in the global scope. You can call them directly without the cs.core prefix.
Returns an array of arguments used to start the process in the command line.
Prints any number of variables as strings separated by " ".
Prints any number of variables as strings separated by " ". Wraps to the next line.
Prints a descriptive string of the js value(s) separated by " ". Wraps to the next line.
Reads input from the command line until a new line returned.
Returns the current timestamp since the runtime started in nanoseconds.
Converts a buffer to a UTF-8 string.
Create a fast random number generator for a given seed. This should not be used for cryptographically secure random numbers.
Invoke a callback after a timeout in milliseconds.
Returns the absolute path of the main script.
Returns the absolute path of the main script's directory. Does not include an ending slash. This is useful if you have additional source or assets that depends on the location of your main script.
Given an app name, returns the platform's app directory to read/write files to. This does not ensure that the directory exists. See cs.files.ensurePath.
Get the current clipboard text.
Set the current clipboard text.
Prints the current stack trace and exits the program with an error code. This is useful to short circuit your program.
Terminate the program with a code. Use code=0 for a successful exit and a positive value for an error exit.
Returns the last error code. API calls that return null will set their error code to be queried by errCode() and errString().
Returns an error message for an error code.
Clears the last error.
Returns the host operating system.
Returns the host operating system and version number as a string.
Returns the host cpu arch and model as a string.
Returns the resource usage of the current process.
Invokes the JS engine garbage collector.
Gets the next random number between 0 and 1.