storage_read

storage_read

Reads a file from DataJet storage. The file content is returned in a result object for further processing.

{% storage_read filename: "data.csv" as result %}

{% if result.ok %}
  {% log result.file.content %}
{% else %}
  {% log result.error %}
{% endif %}

Syntax

{% storage_read filename: "filename" as result_variable %}

Parameters

Parameter
Required
Description

filename

Yes

Name of the file to read from DataJet storage

Result Object

Property
Type
Description

ok

boolean

true if read succeeded

error

string/null

Error message if ok is false, null on success

file.name

string

The filename

file.content

string

The file content as text

file.size

number

File size in bytes

Example result:

Examples

Read and log file content:

Read and parse CSV file:

Read and parse JSON file:

Read file with dynamic filename:

Process file line by line:

Read and send to external API:

Check file size before processing:

Read configuration and use in script:

Read and upload to FTP:

Error handling pattern:

Tag
Description

storage_write

Writes content to DataJet storage

Notes

  • Consumes 1 credit per read operation

  • Maximum file size: 10MB.

  • File content is returned as a string - use | parse_csv or | parse_json for structured data

  • Use storage_write to create or update files in storage

  • If the file doesn't exist, ok will be false with an error message

Last updated