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 %}Storage Limits
Each installation comes with storage. The amount available depends on your plan:
Trial - 5mb
Basic - 20mb
Advanced - 50mb
Pro - 100mb
Not all files can be stored. Storage is currently configured to accept the following file types:
The file extension must be specified in the filename parameter. Writing a file that would exceed your plan's storage limit, or whose extension is not on the accepted list, will fail with an error in result.error.
Syntax
Parameters
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
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:
Related Tags
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: trueto generate a shareable URLPublic URLs are permanent until the file is deleted or overwritten
Use
contentfor text/string data, useurlto download and save remote filesMaximum file size limits apply based on your plan
Last updated