For a while now, people have been complaining that the file functions lag the server significantly. I rewrote them from scratch, they now use a system of usermessages/concommands to send data instead of datastreams, which should significantly reduce lag in both encoding/decoding as well as uploading/downloading data. I got rid of the file storage, so now if you wish to save a file in a buffer type system, it will be up to you. E2s that use the old file functions will need slight modification, but it is well worth it. As for now, I've taken out the file lists since I never saw anyone use them, but if people need them I'll add them in when I get time. I also added in protection on the server for preventing people from overriding client side hooks to bypass size limits. So here are the new functions.


Convars:
wire_expression2_file_delay       (default 5)
wire_expression2_file_max_size (default 100 (in kb))

Error Codes: 
_FILE_UNKNOWN              = 0
_FILE_OK                         = 1 - File uploaded successfully.
_FILE_TIMEOUT               = 2 - File timed out when uploading.
_FILE_404                       = 3 - File not found.
_FILE_TRANSFER_ERROR = 4 - File did not upload correctly.


Functions: 

(void)      fileLoad(string filename)                       - Requests upload of file data from client
(number) fileCanLoad()                                      - Checks whether you are able to load a file
(number) fileLoaded()                                     - Checks if the file has finished uploading
(number) fileLoading()                                    - Checks if the file is in the process of uploading
(string)    fileName()                                          - Gets the name of the file currently in the buffer
(string)    fileRead()                                           - Returns the data of the file currently in the buffer
(number) fileMaxSize()                                      - Returns the maximum file transfer size (in kb)
(number) fileCanWrite()                                     - Checks whether you are able to download a file
(void)      fileWrite(string filename, string data)    - Downloads data and saves it in the specified file
(void)      fileAppend(string filename, string data) - Downloads data and appends it to the specified file (writes a new file if old one does not exist)
(void)      runOnFile(number active)                    - Enabled the fileClk() even on the expression
(number) fileClk()                                              - Returns whether the execution was caused by a file finishing
(number) fileClk(string filename)                        - Returns whether the execution was caused by a specific file finishing
(number) fileStatus()                                         - Returns a number that corresponds to an error code. (if (fileStatus() == _FILE_404){ print("File not Found!") })



Shared Aliases:  

You must wait for a file to finish uploading before a new one starts, and if for some reason the upload halts it will eventually time out.

And from popular request, I added in new directories which you can read from instead of just the e2files/ folder. You specify the special directory by prefixing it with a ">". The new directories are:


"e1shared"  : "ExpressionGate/e2shared"
"e2shared"  : "Expression2/e2shared"
"cpushared" : "CPUChip/e2shared"
"gpushared" : "GPUChip/e2shared"
"dupeshared" : ? some directory in the dups


Example: 

fileLoad(">cpushared/cpu.txt")

(BTW I know the shared directories are easy to bypass clientside, the limits are only there to prevent people from stealing all of your saved data)

Any bugs/comments/suggestions, please don't hesitate to either post here or PM me.