storage_write

Writes a file to DataJet storage. You can save content directly or download from a URL. Files can optionally be made publicly accessible.

{% capture csv_content %}id,name,price
1,Product A,29.99
2,Product B,49.99{% endcapture %}

{% storage_write filename: "products.csv", content: csv_content as result %}

{% if result.ok %}
  {% log "File saved: " | append: result.file.name %}
{% endif %}

Syntax

{% storage_write filename: "filename", content: content_variable as result_variable %}
{% storage_write filename: "filename", url: "https://example.com/file.csv" as result_variable %}
{% storage_write filename: "filename", content: content_variable, public: true as result_variable %}

Parameters

Parameter
Required
Description

filename

Yes

Name of the file to store in DataJet storage

content

Yes*

String content to save

url

Yes*

URL to download and save the file from

public

No

Set to true to make file publicly accessible via URL

*Either content or url is required, but not both.

Result Object

Property
Type
Description

ok

boolean

true if write succeeded

error

string/null

Error message if ok is false, null on success

file.name

string

The filename

file.public

boolean

Whether the file is publicly accessible

file.url

string/null

Public URL (only present if public: true)

Example result:

Example result with public URL:

Examples

Save text content:

Save CSV data:

Save JSON data:

Save with dynamic filename:

Download from URL and save:

Save as public file with shareable URL:

Save API response to storage:

Save FTP download to storage:

Create public download link for customer:

Overwrite existing file:

Error handling:

Tag
Description

storage_read

Reads content from DataJet storage

Notes

  • Consumes 3 credits per write operation

  • Writing to an existing filename will overwrite the file

  • Use public: true to generate a shareable URL

  • Public URLs are permanent until the file is deleted or overwritten

  • Use content for text/string data, use url to download and save remote files

  • Maximum file size limits apply based on your plan

Last updated