EasyFiles

An asset by ASecondGuy
The page banner background of a mountain and forest
EasyFiles hero image

Quick Information

0 ratings
EasyFiles icon image
ASecondGuy
EasyFiles

Writing 5 lines of Code to read & write files is too much for you?With this plugin you only need 1.Also adds a file monitoring signal.It makes everything about files just a little bit easier.Features a clunky file viewer as an example and saved files to look at.

Supported Engine Version
3.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

EasyFiles

Writing 5 lines of Code to read & write files is too much for you? With this plugin you only need 1 It also adds a file monitoring signal. It makes everything about files just a little bit easier.

How to use

Easy Files is available as a autoload script or a Node.

Read & Write

The Script has several functions to read & write text, json, variant (any variable), bytes (PoolByteArray) and csv. All of them work the same so I'll just explain the text version.

read

ERROR read_text(String path, String key="", int compression=-1)

path is the filepath. Relative & paths should work as well.

key is the password for encryption. To leave encryption off input "".

compression sets the compression algorythm. Input -1 to keep compression off. Compression is not compatible with encryption. This will be ignored if a key is given.

Example:

# only reading
print(EasyFiles.read_text("res://text.txt"))
# with encription
print(EasyFiles.read_text("res://text.txt", "the very cool password"))
# with compression using ZSTD compression
print(EasyFiles.read_text("res://text.txt", "", 2))
# with encryption overwriting compression
print(EasyFiles.read_text("res://text.txt", "most secure password ever", 2))

write

String read_text(String path, String text, String key="", int compression=-1)

path is the filepath. Relative & paths should work as well.

text is the text you want to save. For most other write functions this is called value.

key is the password for encryption. To leave encryption off input "".

compression sets the compression algorythm. Input -1 to keep compression off. Compression is not compatible with encryption. This will be ignored if a key is given.

Example:

# only writing
EasyFiles.write_text("res://text.txt", "Important Text")
# with encription
EasyFiles.write_text("res://text.txt", "Important Text", "the very cool password")
# with compression using ZSTD compression
EasyFiles.write_text("res://text.txt", "Important Text", "", 2)
# with encryption overwriting compression
EasyFiles.write_text("res://text.txt", "Important Text", "most secure password ever", 2)

General File Operations

File Monitoring

Files get checked every second. Use set_file_monitor_intervall(float time) to change that interval. Use force_file_modification_check() to manually check whenever you want. Avoid using this too often. Use pause_file_monitoring() and resume_file_monitoring() to pause or resume the automatic checking. Use get_monitored_files() to get a list of all monitored files. Use add_file_monitor() and remove_file_monitor() too add or remove files to monitor. Connect to the file_modified signal. It also gives the path to the modified file. Use multiple EasyFiles nodes to seperatly monitor groups of files.

  • void set_file_monitor_intervall(float time) time is the new intervall.

  • void force_file_modification_check() Manually check whenever you want. Avoid using this too often.

  • void pause_file_monitoring()

  • void resume_file_monitoring()

  • Array get_monitored_files()

  • ERROR add_file_monitor(String path)

    Will throw ERR_ALREADY_EXISTS if file is already monitored.

  • ERROR remove_file_monitor(String path)

    Will throw ERR_DOES_NOT_EXIST if file is not being monitored.

Writing 5 lines of Code to read & write files is too much for you?
With this plugin you only need 1.
Also adds a file monitoring signal.
It makes everything about files just a little bit easier.
Features a clunky file viewer as an example and saved files to look at.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
EasyFiles icon image
ASecondGuy
EasyFiles

Writing 5 lines of Code to read & write files is too much for you?With this plugin you only need 1.Also adds a file monitoring signal.It makes everything about files just a little bit easier.Features a clunky file viewer as an example and saved files to look at.

Supported Engine Version
3.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers