Skip to main content

Quick Start

Learn the basics of EFM in 5 minutes.

1. Check if a File Exists

The simplest operation - check whether a file exists on disk:

FileExists(Directory, Name) -> bool

Example: Check if config.json exists in the Saved folder:

Directory = GetGameSavedDirectory()
Name = "config.json"
Exists = FileExists(Directory, Name)

2. Create and Write a File

Create a new text file and write content to it:

CreateFile(Directory, Name) -> bSuccess, NewCreatedFile
NewCreatedFile.AppendString("Hello, World!")

Or write bytes directly:

NewCreatedFile.WriteBytes(YourByteArray)

3. Read a File

Read a file and get its content as strings:

ReadFile(Directory, Name) -> bSuccess, ReadFile
Lines = ReadFile.GetStrings()
Content = ReadFile.GetSingleString()

4. Read and Write JSON

Write a JSON file:

Data = Make Map
Add "PlayerName" -> "Hero"
Add "Level" -> "42"
Add "Score" -> "9999"
WriteJsonFile(SavedDir + "save.json", Data)

Read it back:

ReadJsonFile(SavedDir + "save.json", OutData)
PlayerName = OutData["PlayerName"]

5. Download a File from the Web

DownloadFile(
URL: "https://example.com/data.json",
SavePath: GetGameSavedDirectory() + "data.json",
OnProgress: UpdateProgressBar(ProgressPercent),
OnComplete: OnDownloadFinished(bSuccess, URL, SavedPath)
)

6. Compress Files to ZIP

CompressFiles(
ZipFilePath: GetGameSavedDirectory() + "backup.zip",
FilesToCompress: [File1, File2, File3],
bAbsolutePath: false
)

7. Watch a File for Changes

Watcher = Create UEFMFileWatcher
Watcher.OnFileChanged = OnFileChangedEvent
Watcher.StartWatching(GetGameSavedDirectory() + "config.ini")

When the file changes, OnFileChanged fires with the file path and change type.

Next Steps

  • Explore the API Reference for all available functions
  • Read the Guides for detailed tutorials
  • Run Run EFM Diagnostics to verify all functions work on your platform