Introduction
Using Node.js' file system module can be a hassle. Getting it to work both in playtest and after deployment seems to be something people are having trouble it. This aims to give some easy to use functions as tools for manipulating the game folder's files using Node.js – both for people who've tried implementing the .fs module and failed and for anyone with basic script call knowledge who wants to play with files.
Does not work on mobile!
Features
This plugin allows you to do things with your game files and folders from within the game itself.
file.exist will check whether a file exists or not
file.write will write or overwrite a file with the text you enter
file.append will add text to an already existing file
file.read will read a file and output its contents as text
file.rename will rename a file to the filename you enter
file.erase will permanently delete a file
How to use
Spoiler: file.exist
file.exist
Checks if a file in your game folder exists or not.
Intended for the conditional branch script box.
Code:
file.exist("path", "file.type")
复制代码
"" for path means the main game folder, "" for file checks if folder exists
These all return TRUE:
Code:
file.exist("", "index.html")
file.exist("data", "")
file.exist("img/system", "Window.png")
复制代码
This returns FALSE unless it exists:
Code:
file.exist("asdf/gh", "jkl.txt")
复制代码
Screenshot example:
Spoiler: file.write
file.write
Writes a new file with the desired data.
Intended for script calls.
Code:
file.write("path", "file.type", "stuff")
复制代码
"" for path means the main game folder, the rest is required.
file.erase
Do not use this one unless you know what you're doing!
Permanently deletes a file, be VERY careful not to erase important files.
Intended for script calls.
Code:
file.erase("path", "file.type")
复制代码
"" for path means the main game folder, the rest is required.
Some examples:
Code:
file.erase("", "ieie.txt")
复制代码
Code:
file.erase("data", "johnromero.json")
复制代码
Screenshot example:
Terms of use
You don't have to credit me but I'd appreciate it!
For commercial use, you gotta credit me!