storage_write
Writes a file to DataJet storage.
{% storage_write filename: "file.csv", content:string_content, public:false as read_result %}Accepts:
filename- the name of the file stored in DataJet storagecontent- the content of the file to saveurl- the url of the file to savepublic- if true, a link to file will be generated and file will be publicly accessible
Use either content or url.
Result is saved in a variable that follows as keyword.
Result has following format:
{
"ok": true,
"error": null, // null only when ok: true
"file": {
"name": "file.csv",
"url": null, // link to file. only present if public: true
"public": false
}
}
Code below writes file: file.csv to the storage. Content is captured inside content variable
{% capture content %}
col1,col2
A,B
{% endcapture %}
{% storage_write filename: "file.csv", content:content, public:false as write_result %}
{% if write_result.ok %}
{% comment %}File file.csv saved in storage.{% endcomment %}
{% else %}
{% comment %}Error while saving file to storage{% endcomment %}
{% log read_result.error %}
{% endif %}Last updated