Mobi Builder


File system


Introduction

Even though Mobi Builder applications are based off HTML, CSS and JavaScript (the three main programming languages used when creating websites (this does not mean that your applications will need an internet connection to work)), Mobi Builder applications do support some native functionality, like the file system. In this tutorial, you will learn how to use the file system in your Mobi Builder application. This can allow you to store user data locally on the users device. For example, this may be useful in a notepad editor where the users notes need to be saved so that the users can come back to their notes later. If you need to save data on the cloud so that multiple users can access this data, we recommend that you use firebase cloud.



Important note

Files created using the Mobi Builder file system blocks are only accessible by your application. Users can't access them.



Initializing the file system

Firstly, before you can use the file system, it needs to be initialized. Use the following block to achieve this.



Write a file

The following block will create a file if it doesn't already exist. If the file does already exist, it will replace the current contents of the file with the new content that you are providing.



Read from a file

To read from a file, you can use the following block. The contents of the file is stored in the data variable.