Files Module

Load file content

Description:
Load a file’s content and save it to the target.
Set dialog to true if you want to use the file picker dialog.
If you want to load it from a particular url you can define it in the files property.

Dialog example:

{
    "type": "files",
    "action": "load", 
    "args": {
        "dialog": "true",
        "target": "$data.fileContent"
    }
}

Files example:

{
    "type": "files",
    "action": "load", 
    "args": {
        "files": ["/readme.md"],
        "target": "$data.fileContent"
    }
}

Save value to file

Description:
Save the content to your local machine using the browsers download feature.

{
    "type": "files",
    "action": "save", 
    "args": {
        "details": [
            {
                "name": "my_file",
                "ext": "txt",
                "type": "text/plain",
                "value": "$data.text"
            }
        ]
    }
}

Details is an array so you can download more than one file at a time.

Download canvas as image

Description:
Save the content of a canvas element as a png using the browsers download feature.

{
    "type": "files",
    "action": "save_canvas", 
    "args": {
        "source": "#my-chart",
        "name": "my-chart"
    }
}