logoCloudomation Docs

    File Handling with Cloudomation

    Cloudomation offers several options for working with files and file systems. This article describes the file handling functionality available to you on the Cloudomation platform, which allows you to work with files without needing a separate environment (e.g. a remote server) on which your file operations happen.

    The system.file Function

    The file function allows you to create file objects. Arguments:

    • name – string. The name of the file. If it doesn’t exist, it will be created.

    Note: file contents will be overwritten without warning if a file of the same name already exists.


    • The file object


    import flow_api
    def handler(system: flow_api.System, this: flow_api.Execution):
    # create a file object
    file_object = system.file('myfile.txt')
    # write to the file'saving some text')
    # read from the file
    text = file_object.get('content')
    return this.success('all done')

    The system.files Function

    The system.files function lists all files in a given directory.

    files = system.files(dir='flows', glob='**/*.py')


    • **filters – dictionary. Filters to limit the search results.


    • An iterator over all matched files which generates File objects.


    import flow_api
    def handler(system: flow_api.System, this: flow_api.Execution):
    # list all files on the Cloudomation platform
    all_files = system.files()
    for file in all_files:
    # List only *.zip files
    zip_files = system.files(filter={
    'field': 'name',
    'op': 'like',
    'value': '',
    for zip_file in zip_files:
    return this.success('all done')
    Knowledge Base — Previous
    Next — Knowledge Base
    Flow Scripts