Skip to content

Latest commit

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

FileHelper

FileHelper

  • UE4 Plugin to handle files operations
  • This is a blueprint library plugin
  • It exposes 50+ functions to handle various files format and file system operations
  • Allows you to easily serialize a custom struct to JSON / XML and deserialize it back to a struct
  • Allows you to read/write .ini configuration files
  • Allows you to export/import a datatable from/to Json or CSV
  • Take screenshots and load them into textures
  • Can be used in any blueprint

Nodes

Link to the plugin in the marketplace

Documentation


Paths

Paths

NodeInputsOutputsNote
GetEngineDirectoriesvoidStruct(FEnginePath)Returns all the engine related paths
GetProjectDirectoriesvoidStruct(FProjectPath)Returns all the project related paths

Files

file

Note: Be carefull using these nodes, you are accessing the file system of the user's computer, ensure your code is working as intended before shipping
NodeInputsOutputsNote
ReadTextFilePath(String)Success(Bool), Output(String)Reads the whole content of a text file
WriteTextFilePath(String), Content(String), Append(Bool), Force(Bool)Success(Bool), Error(Text)Writes text content into a file
ReadLineFilePath(String), Pattern(String)Success(Bool), Output(Array(String))Reads lines of a file, if you specify a pattern (regex), reads only the lines that matches this pattern
WriteLineFilePath(String), Content(Array(String)), Append(Bool), Force(Bool)Success(Bool), Error(Text)Writes lines into a file
ReadByteFilePath(String)Success(Bool), Output(Array(Byte))Reads binary content from a file
WriteByteFilePath(String), Content(Array(Byte)), Append(Bool), Force(Bool)Success(Bool), Error(Text)Writes binary content to a file
WriteCSVFilePath(String), Headers(Array(String)), Data(Array(String)), Force(Bool)Success(Bool), Total(Int)Writes csv headers and datas to a file, delimiter will be ,
ReadCSVFilePath(String), HeaderFirst(Bool)Success(Bool), Headers(Array(String)), Data(Array(String)), Total(Int)Reads csv headers and data from a file, delimiter must be ,

Network

These nodes allows you to encode/decode content from/to base64

network

Note: These nodes can be useful to send content on the network (image,text, file)
NodeInputsOutputsNote
StrToBase64Source(String)Result(String)Encodes a string to a base64 string
StrFromBase64Base64Str(String)Success(Bool), Result(String)Decodes a string from a base64 string
BytesToBase64Source(Array(Byte))Result(String)Encodes a binary content to a base64 string
BytesFromBase64Base64Str(String)Success(Bool), Result(Array(Byte))Decodes a binary content from a base64 string

CSV

csv

NodeInputsOutputsNote
StringToCSVContent(String), HeaderFirst(Bool)Success(Bool), Headers(Array(String)), Data(Array(String)), Total(Int)Extracts headers, data from csv string, delimiter must be ,
CSVToStringHeaders(Array(String)), Data(Array(String))Success(Bool), Result(String), Total(Int)Converts headers, data array into a csv string, delimiter will be ,

Serialization

Serialization

Do not use fields with withespaces or special characters in your structures, they will get serialized but you won't be able to deserialize them !
Note v1.2 : You can now provide (map, array, set, object, struct) and it will get (de)serialized, do not use scalar types like string, numeric, boolean...
Note v1.1 and minor : Please provide only struct (not array of struct, not map of struct, not set of struct) to these functions, you can put maps, sets, array in the struct you wish to export, it will work, you can also put any other object, it will get serialized and when deserializing the object will be created and available as expected
NodeInputsOutputsNote
StructToXMLInStruct(AnyStruct)Success(Bool), Xml(String)Converts any type of struct into XML string
XMLToStructXml(String), OutStruct(AnyStruct)Success(Bool)Converts an XML string back into the input struct provided, returns whether the parsing was successful carried
StructToJsonInStruct(AnyStruct)Success(Bool), Json(String)Converts any type of struct into JSON string
JsonToStructJson(String), OutStruct(AnyStruct)Success(Bool)Converts a json string back into the input struct provided, returns whether the parsing was successful carried

File system

file-system

Note: Be carefull using these nodes, you are accessing the file system of the user's computer, ensure your code is working as intended before shipping
NodeInputsOutputsNote
IsFilePath(String)Success(Bool)Checks whether a path is a valid file
IsDirectoryPath(String)Success(Bool)Checks whether a path is a valid directory
IsValidFilenameFilename(String)Success(Bool)Checks whether a filename is valid and can be used on this file system, do not hit the disk
ValidateFilenameFilename(String)Result(Bool), ValidName(String)Sanitizes a filename to be used on the file system, do not hit the disk
SetReadOnlyFlagPath(String), Flag(Bool)Result(Bool)Sets the read only property on a file, if the file system supports it
GetReadOnlyFlagPath(String)Result(Bool)Gets the read only property on a file, if the file system supports it
GetFileSizePath(String)Size(Int64)Gets the size of a file on the file system in bytes
ListDirectoryPath(String), Pattern(String), ShowFile(Bool), ShowDirectory(Bool), Recursive(Bool)Result(Bool), Nodes(Array(String))Lists all nodes on that path, file or directory, if pattern (regex) is not empty, returns only the one that matches it, can search recursively
MakeDirectoryPath(String), Recursive(Bool)Result(Bool)Creates new directory, can work recursively
RemoveDirectoryPath(String), Recursive(Bool)Result(Bool)Removes a directory, if it is not empty, check the recursive option
CopyDirectorySource(String), Dest(String)Result(Bool)Copies the content of a directory to a destination path, overwrites existing content
MoveDirectorySource(String), Dest(String)Result(Bool)Moves the content of a directory to a destination path, overwrites existing content
NodeStatsPath(String)Result(Bool), Stats(FCustomNodeStat)Returns the stats of a node if it exists
RemoveFilePath(String)Result(Bool)Removes a file from the file system
CopyFileSource(String), Dest(String), Force(Bool)Result(Bool)Copies a file to a destination path
MoveFileSource(String), Dest(String), Force(Bool)Result(Bool)Moves a file to a destination path
RenameFilePath(String), Name(String)Result(Bool)Renames a file
PathPartsPath(String)PathPart(String), BasePart(String), ExtensionPart(String), Filename(String)Returns the different parts of path, do not hit the disk

Screenshot

Screenshot

NodeInputsOutputsNote
TakeScreenShotFilename(String), PrefixTimestamp(Bool), ShowUI(Bool)Result(Bool), Path(String)Take a screenshot from current the view and saves it in the default screenshot folder and return the path
LoadScreenShotPath(String)Result(Bool), Screenshot(Texture2D)Loads a screenshot from a path into a Texture2D, do not use this right after takescreenshot because the file might not be already written on disk, use the async node following
TakeScreenshotFilename(String), PrefixTimestamp(Bool), ShowUI(Bool)OnCompleted(Texture2D, String), OnFailed()Async node to take screenshot and return a texture with the actual screenshot and path on completion

Datatable

Datatable

Note: You need to know the correct row struct in order to reimport the datatable content correctly
Do not use fields with withespaces or special characters in your structures, they will get exported but you won't be able to import them back !
NodeInputsOutputsNote
DataTableToCSVTable(DataTable)Result(Bool), Output(String)Converts a datatable to csv string
CSVToDataTableInput(String), RowStruct(AnyStruct)Result(Bool), Table(DataTable)Converts a csv string to datatable using the specified struct as row model
DataTableToJSONTable(DataTable)Result(Bool), Output(String)Converts a datatable to json string
JSONToDataTableInput(String), RowStruct(AnyStruct)Result(Bool), Table(DataTable)Converts a json string to datatable using the specified struct as row model

Config

Config

Note: These nodes helps to read/write configuration files (*.ini), you can pass the following variables to these function (Bool, Int, Double, Float, String, Array(String), Rotator, Vector, LinearColor, Vector4, Vector2D) anything else will fail, keep in mind that a restart of the engine/game is needed for these changes to be taken into account !
NodeInputsOutputsNote
ReadConfigFilepath(String), Section(String), Key(String), SingleLineArrayRead(Bool), OutValue(AnyStruct)Result(Bool)Reads a config file and extracts the section->key value into OutValue (can be any type mentionned earlier), check SingleLineArrayRead if you know the value is an array on a single line in the file else uncheck it
WriteConfigFilepath(String), Section(String), Key(String), SingleLineArrayWrite(Bool), Value(AnyStruct)Result(Bool)Write a config file value at the section->key, creates the file if not found, check SingleLineArrayWrite to write an array on a single line instead of multiple lines
RemoveCongigFilepath(String), Section(String), Key(String)Result(Bool)Removes the value associated with section->key in the file

About

UE Plugin to handle files operations

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors