datasource.binarySave
Saves a file to the MODLR filesystem using a base64-encoded string.
js
datasource.binarySave(file_name, base64_string)Parameters
file_name(string): The name (with path) of the file where you want to save the binary content.base64_string(string): A base64-encoded string representing the binary content you want to save.
Returns
boolean: A boolean value indicating whether the save operation succeeded (true) or failed (false).
Examples
js
var base64Content = "SGVsbG8gd29ybGQh"; // Example base64 string representing "Hello world!"
var saveResult = datasource.binarySave("path/to/my_file.bin", base64Content);
if (saveResult) {
console.log("Binary file saved successfully.");
} else {
console.log("Failed to save the binary file.");
}