Skip to content

datasource.binaryLoad

Returns a files contents as a base64-encoded string from the MODLR filesystem.

js
datasource.binaryLoad(file_name)
datasource.binaryLoad(file_name)

Parameters

  • file_name (string): The name (with path) of the file you want to load from the filesystem.

Returns

  • string: A base64-encoded string representing the contents of the loaded file. Returns null if the file cannot be found or there's an error during the loading process.

Examples

js
var base64Content = datasource.binaryLoad("path/to/my_file.bin");
if (base64Content) {
    console.log("File loaded successfully.");
    console.log("Base64 Content:", base64Content);
} else {
    console.log("Failed to load the file or file not found.");
}
var base64Content = datasource.binaryLoad("path/to/my_file.bin");
if (base64Content) {
    console.log("File loaded successfully.");
    console.log("Base64 Content:", base64Content);
} else {
    console.log("Failed to load the file or file not found.");
}