Skip to main content

Flow

The "Flow" object lets you perform actions on the flow, it exposes helper methods to the code.

/**
* Creates a directory if it does not already exist
* @param {string} path - The path of the directory
*/
CreateDirectoryIfNotExists: function (path:string) { },
/**
* Gets the size of a directory in bytes
* @param {string} path - The path of the directory
* @returns {number} - The size of the directory in bytes
*/
GetDirectorySize: function (path:string):number { },
/**
* Gets a parameter from the collection, these are generally complex objects set by plugins
* @param {string} key - The key of the parameter to get
* @returns {object} - The parameter if found
*/
GetParameter: function (key:string):any { },
/**
* Checks if a plugin is available
* @param {string} name - The name of the plugin
* @returns {boolean} - True if the plugin is available, otherwise false
*/
HasPlugin: function(name:string):boolean { },
/**
* Maps a path to its real path
* @param {string} path - The path to map
* @returns {string} - The real path
*/
MapPath: function (path:string) { },
/**
* Moves a file to a destination path
* @param {string} destination - The destination path
*/
MoveFile: function (destination:string) { },
/**
* Resets the working file to the original input file
*/
ResetWorkingFile: function () { },
/**
* Sets the working file with an optional delete flag
* @param {string} filename - The filename of the working file
* @param {boolean} dontDelete - True to prevent deletion of the file, false otherwise
*/
SetWorkingFile: function (filename:string, dontDelete:boolean) { },
/**
* Sets the value of a parameter by its key
* @param {string} key - The key of the parameter to set
* @param {*} value - The value to set for the parameter
*/
SetParameter: function (key:string, value) { },
/**
* Generates a new unique identifier (GUID)
* @returns {string} - The new GUID
*/
NewGuid: function ():string { },
/**
* Copies a file to the temporary path
* @param {string} filename - The filename to copy to the temporary path
* @returns {string} - The temporary path
*/
CopyToTemp: function (filename:string):string { }
/**
* Records additional information that will be shown on the processing runner
* @param {string} name - The name or label to show
* @param {any} value - The value to show next to the name
* @param {any} steps - How many steps to keep this information visible for, each flow part change decreases the steps
*/
AdditionalInfoRecorder: function (name:string, value:any, steps:number):string { }
/**
* The file name
* @type {string}
*/
FileName: string,
/**
* The temporary path
* @type {string}
*/
TempPath: string,
/**
* The temporary path name
* @type {string}
*/
TempPathName: string,
/**
* The temporary path host
* @type {string}
*/
TempPathHost: string,
/**
* The unique identifier of the runner
* @type {string}
*/
RunnerUid: string,
/**
* The working file
* @type {string}
*/
WorkingFile: string,
/**
* The working file name
* @type {string}
*/
WorkingFileName: string,
/**
* The size of the working file
* @type {number}
*/
WorkingFileSize: number,
/**
* The relative file path
* @type {string}
*/
RelativeFile: string,
/**
* If this flow is running against a directory, if false then it's running against a file
* @type {boolean}
*/
IsDirectory: boolean,
/**
* A flag indicating if it's running in a Docker environment
* @type {boolean}
*/
IsDocker: boolean,
/**
* A flag indicating if it's running on a Windows OS
* @type {boolean}
*/
IsWindows: boolean,
/**
* A flag indicating if it's running on a Linux OS
* @type {boolean}
*/
IsLinux: boolean,
/**
* A flag indicating if it's running on a macOS
* @type {boolean}
*/
IsMac: boolean,
/**
* A flag indicating if it's running on an ARM architecture
* @type {boolean}
*/
IsArm: boolean,
/**
* The library path
* @type {string}
*/
LibraryPath: string,
/**
* Execute a process and capture the output
* you can use arguments for a string argument list, or argumentList which is an string array and will escape the arguments for you correctly
* timeout is optional, number of seconds to wait before killing the process
* @param {{
* command: string,
* arguments: string,
* argumentList: string[],
* timeout: number,
* workingDirectory: string
* }} args - The arguments and options for the command execution
* @returns {{
* completed: boolean,
* exitCode: number,
* output: string,
* standardOutput: string,
* standardError: string
* }} - The result of the command execution
*/
Execute: function (args:{{ command: string, arguments: string, argumentList: string[], timeout: number, workingDirectory: string}}):
{{ completed: boolean, exitCode: number, output: string, standardOutput: string, standardError: string }} { },
}