toFile
Table of Contents
Overview
The toFile function takes any content and creates a file object.
Note:
- It is advisable to use file objects from the cloud directly and only in the absence of such means should this task be used.
- The toFile task is not a utility to create files of desired type. It only helps wrapping up contents inside a file object. So there shall be instances where the file might appear broken or corrupted unless appropriate content is supplied during file creation.
- The file object would be created in the name of the file along with the extension(if provided).
Return Type
- FILE
Syntax
<variable> = <value>.toFile(<file_name>);
where,
Parameter | Data type | Description |
<variable> | FILE | Variable which will contain the created file object. |
<value> | TEXT/COLLECTION | The value that needs to be converted to a file object. Note: In Zoho Creator, the input value cannot be more than 50 MB. |
<file_name> | TEXT | The value which will represent the file name and its extension. |
Example
Imagine that you need to put feedback content provided by a customer into a file object. The toFile function can convert the text into a file with a specified name and extension.
changes = collection(); changes.insert("Provide UI builder"); changes.insert("insert different layouts"); changes.insert("introduce different font families"); file_object = changes.toFile("feedback"); info file_object; // This would create a file with the name "feedback" with data included in the collection.