- Provides basic functionality for working with files and folders
- Provides a set of methods to load files through a file buffer that adds additional abilities for retrieving the file contents from disk.
- 4D v18 is required.
Copy the FileFolder_Utils.4dbase
into the Components folder of your application. It is suggested that you compile the component before installing it into your own projects.
Example #1 - tbd
code here
Example #2 - tbd
code here
The methods provide a some basic functionality for working with files and folders.
Returns true if the file exists. Any missing parent folders will be created if missing.
Returns true if the file is a CSV. Recognizes a 1st line of of the csv file is a "sep=" line.
TESTS performed:
- Is file extension ".csv" or ".txt"
- Look at first line, expect line of comma separated values.
- At least 2 non-empty values in the header line.
Returns true if the image file is a JPG. The file extension is ignored, it looks at the image directly.
Returns true if the image file is a PNG. The file extension is ignored, it looks at the image directly.
Returns true if the file is tab-delimited.
TESTS performed:
- Is file extension ".tsv" or ".txt"
- Look at first line, expect line of tab-delimited values.
- At least 2 non-empty values in the header line.
Returns true if the file exists.
Returns the parent folder of the folderPath passed in.
Creates a folder if it does not exist. If necessary, it will recursively create the parent folders as well.
Initializes the necessary vars and pre-fills the buffer from the already opened file.
Scans the filebuffer to figure out what the EOL is.
Returns true if we are at the end of file.
Returns a logical position in the file.
This method returns the specified number of bytes. If it cannot then that means that the file is empty.
FileBuffer_FetchData_ByString (matchOnText:c_text{; matchOnText2:c_text}) returns fileContent:c_text
Returns text from the buffer up to AND INCLUDING the matchOnText or matchOnText2 values.
NOTE: This differs from RECEIVE PACKET.
Returns fileContent up to the number of characters specified without advancing the current position in the file.
Populates the array with the parsed values from the line. Recognizes a 1st line of "sep=" line.
Fills the array with the next line of tab delimited values from the open file.