UEFMFile
A BlueprintType UObject representing a file on disk. Provides methods for reading, writing, and manipulating file data without needing to specify the directory and name each time.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
Name | FString | ReadOnly | The file name |
Extension | FString | ReadOnly | The file extension |
Directory | FString | ReadOnly | The directory containing the file |
Information Functions
GetFullPath
Pure Returns the full path (Directory + Name + Extension).
C++
FString GetFullPath()
Blueprint Node
GetName
FString GetName()
GetExtension
FString GetExtension()
GetDirectory
FString GetDirectory()
GetSizeInBytes
Pure Returns file size in bytes.
C++
int64 GetSizeInBytes()
Blueprint Node
GetSizeInMegaBytes
Pure Returns file size in megabytes.
C++
double GetSizeInMegaBytes()
Blueprint Node
GetHumanReadableSize
Pure Returns human-readable size string (e.g., "1.5 MB").
C++
FString GetHumanReadableSize()
Blueprint Node
GetCreationTime
PureC++
FDateTime GetCreationTime()
Blueprint Node
GetLastModifiedTime
PureC++
FDateTime GetLastModifiedTime()
Blueprint Node
GetLastAccessTime
PureC++
FDateTime GetLastAccessTime()
Blueprint Node
GetMD5
PureC++
FString GetMD5()
Blueprint Node
GetSHA1
PureC++
FString GetSHA1()
Blueprint Node
IsReadOnly
PureC++
bool IsReadOnly()
Blueprint Node
SetReadOnly
CallableC++
bool SetReadOnly(bool bReadOnly)
Blueprint Node
Data Access - Strings
GetStrings
Pure Reads all lines into a string array.
C++
TArray<FString> GetStrings()
Blueprint Node
GetSingleString
Pure Reads entire file into one string.
C++
FString GetSingleString()
Blueprint Node
AppendString
Callable Appends a string to the file.
C++
void AppendString(FString StringToAppend)
Blueprint Node
Data Access - Images
GetTexture
Pure Converts the file to a Texture2D.
C++
void GetTexture(EImageConversionResult& ConversionResult, UTexture2D*& Texture)
Blueprint Node
| Parameter | Type | Direction | Description |
|---|---|---|---|
ConversionResult | EImageConversionResult | Out | Result of the conversion |
Texture | UTexture2D* | Out | The converted texture |
Data Access - Sound
GetSound
Pure Converts the file to a SoundWave.
C++
USoundWave* GetSound()
Blueprint Node
Data Access - Raw Bytes
GetBytes
PureC++
TArray<uint8> GetBytes()
Blueprint Node
WriteBytes
CallableC++
bool WriteBytes(TArray<uint8> ByteDataToWrite)
Blueprint Node
Data Access - CSV
GetCsvDataAsString
PureC++
FString GetCsvDataAsString(FString Delimiter = TEXT(","))
Blueprint Node
Data Access - INI
GetIniDataAsString
PureC++
FString GetIniDataAsString()
Blueprint Node
Data Access - JSON
GetJsonData
Pure Reads JSON file into a TMap.
C++
TMap<FString, FString> GetJsonData()
Blueprint Node
WriteJsonData
Callable Writes a TMap as JSON to the file.
C++
bool WriteJsonData(TMap<FString, FString> Data)
Blueprint Node
Data Access - Encryption
Encrypt
Callable Encrypts the file with XOR.
C++
bool Encrypt(FString Key)
Blueprint Node
Decrypt
Callable Decrypts the file with XOR.
C++
bool Decrypt(FString Key)
Blueprint Node
Chunked Operations
ReadChunk
Callable Reads a chunk of bytes from the file.
C++
bool ReadChunk(int64 Offset, int32 Size, TArray<uint8>& OutData)
Blueprint Node
| Parameter | Type | Direction | Description |
|---|---|---|---|
Offset | int64 | In | Byte offset to start reading from |
Size | int32 | In | Number of bytes to read |
OutData | TArray<uint8> | Out | The read bytes |
WriteChunk
Callable Writes bytes at a specific offset.
C++
bool WriteChunk(int64 Offset, const TArray<uint8>& Data)
Blueprint Node
AppendChunk
Callable Appends bytes to the end of the file.
C++
bool AppendChunk(const TArray<uint8>& Data)
Blueprint Node
Usage Example
// Create a file
CreateFile(GetGameSavedDirectory(), "data.txt") -> bSuccess, MyFile
// Write to it
MyFile.AppendString("Line 1")
MyFile.AppendString("Line 2")
// Read it back
Lines = MyFile.GetStrings()
Size = MyFile.GetSizeInBytes()
ReadableSize = MyFile.GetHumanReadableSize() // e.g., "12 B"
// Get hash
Hash = MyFile.GetMD5()
// Check attributes
bReadOnly = MyFile.IsReadOnly()