MZ Phileas`s File Manager

Plugin name: Phileas`s File Manager

Author: Phileas

Version: 1.1.0 for MZ

Release date:
1.0.0 - 2025.February.16
1.0.1 - 2025.February.17
1.0.2 - 2025.March.01
1.0.3 - 2025.April.23
1.1.0 - 2025.June.10

Plugin description:
This is an auxiliary plugin that allows to work with files in any environment.

The plugin provides the following methods that can be used in other plugins or scripts:
  • Phileas_FileManager.fileExistsSync - synchronously checks for file availability
  • Phileas_FileManager.getFilesInDirectory - returns a list of files in the specified directory, including nested directories of any level
Contact the author of the plugin if you need other methods or commands of the plugin.

In order for the plugin to work in the browser and on mobile devices, it is necessary the current data/FilesStamp.json file.
This file contains information about all the game files.
This file is automatically generated when the game starts, if enabled the updateStamp parameter. This plugin parameter is recommended disable it before deployment.

Code

License

This plugin is released under MIT license.
This means that you can freely use the plugin in non-commercial and commercial games and even edit it.
But be sure to include me in the credits!

Compatibility:
If there are any problems, write to me.
1.0.1
Added methods for reading and writing files:
  • Phileas_FileManager.readFile(path) - asynchronously returns the contents of the file
  • Phileas_FileManager.readJsonFile(path) - asynchronously returns the deserialized contents of the JSON file
  • Phileas_FileManager.writeFile(path, data) - asynchronously saves the specified data to a file
  • Phileas_FileManager.writeJsonFile(path, data) - serializes the specified data in JSON and asynchronously saves it to a file
  • Phileas_FileManager.downloadFile(path) - downloads a file from the local storage. This method only works in a web environment and on mobile platforms. The method must be called after saving the file using Phileas_FileManager.writeFile or Phileas_FileManager.writeJsonFile
  • Phileas_FileManager.importSaveFile - imports the save file to and on Android
To save files on Android, you need to add this Java code to Android Studio when building the apk (experimental: each individual case may have its own problems).
1.0.2
Fixed read/write json file methods.
1.0.3
When writing a file, non-existent folders are created from its path.
1.1.0

The web version now uses IndexedDB instead of localStorage. It turned out that the volume of localStorage has a limit of 5 MB, and it is possible to store much more data in IndexedDB.
There is an important reminder.

This plugin has the "Update files stamp at startup" parameter. If this parameter is enabled, the file that stores the project's file structure is updated when the game is started. This file is located in the data folder, so the editor responds to updates in this folder.

The file stamp is necessary for the correct operation of the game in web mode and on the mobile platform. If your game will run only on PC, then you can disable this parameter and forget about it. If your game is going to run in a browser, then it is enough to enable this parameter once before building the release. Do not forget to disable the parameter after that, so that the stamp is not updated by the players.

If you have any suggestions on how to make the feature more convenient, I will be happy to listen.

Original thread: https://forums.rpgmakerweb.com/threads/phileas-s-file-manager.175503/