LocalFiles LocalFiles

yaml
type: "io.kestra.plugin.core.storage.LocalFiles"

This task is deprecated and replaced by inputFiles property available in all script tasks and in the WorkingDirectory task. Check the migration guide for more details.

This task was intended to be used along with the WorkingDirectory task to create temporary files. This task suffers from multiple limitations e.g. it cannot be skipped, so setting disabled: true will have no effect. Overall, the WorkingDirectory task is more flexible and should be used instead of this task. This task will be removed in a future version of Kestra.

Examples

Output local files created in a Python task and load them to S3.

yaml
    id: outputs_from_python_task
    namespace: company.team

    tasks:
      - id: wdir
        type: io.kestra.plugin.core.flow.WorkingDirectory
        tasks:
          - id: clone_repository
            type: io.kestra.plugin.git.Clone
            url: https://github.com/kestra-io/examples
            branch: main

          - id: git_python_scripts
            type: io.kestra.plugin.scripts.python.Commands
            warningOnStdErr: false
            runner: DOCKER
            docker:
              image: ghcr.io/kestra-io/pydata:latest
            beforeCommands:
              - pip install faker > /dev/null
            commands:
              - python examples/scripts/etl_script.py
              - python examples/scripts/generate_orders.py

          - id: export_files
            type: io.kestra.plugin.core.storage.LocalFiles
            outputs:
              - orders.csv
              - "*.parquet"

      - id: load_csv_to_s3
        type: io.kestra.plugin.aws.s3.Upload
        accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
        secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
        region: eu-central-1
        bucket: kestraio
        key: stage/orders.csv
        from: "{{ outputs.export_files.outputFiles['orders.csv'] }}"
        disabled: true

Create a local file that will be accessible to a bash task.

yaml
id: "local_files"
namespace: "io.kestra.tests"

tasks:
  - id: working_dir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
    - id: input_files
      type: io.kestra.plugin.core.storage.LocalFiles
      inputs:
        hello.txt: "Hello World\n"
        address.json: "{{ outputs.my_task_id.uri }}"
    - id: bash
      type: io.kestra.plugin.scripts.shell.Commands
      commands:
        - cat hello.txt

Send local files to Kestra's internal storage.

yaml
id: "local_files"
namespace: "io.kestra.tests"

tasks:
  - id: working_dir
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
    - id: bash
      type: io.kestra.plugin.scripts.shell.Commands
      commands:
        - mkdir -p sub/dir
        - echo "Hello from Bash" >> sub/dir/bash1.txt
        - echo "Hello from Bash" >> sub/dir/bash2.txt
    - id: output_files
      type: io.kestra.plugin.core.storage.LocalFiles
      outputs:
        - sub/**

Properties

inputs

  • Type:
    • object
    • string
  • Dynamic: ✔️
  • Required:

The files to be created on the local filesystem. It can be a map or a JSON object.

outputs

  • Type: array
  • SubType: string
  • Dynamic: ✔️
  • Required:

The files from the local filesystem to be sent to the Kestra's internal storage.

Must be a list of glob expressions relative to the current working directory, some examples: my-dir/**, my-dir/*/** or my-dir/my-file.txt.

Outputs

uris

  • Type: object
  • SubType: string
  • Required:

The URI of the files that have been sent to the Kestra's internal storage.

Was this page helpful?