TWebLocalFolder
TWebLocalFolder
is a non-visual component that allows to retrieve folder information on the
local file system. Note that this uses the web standards local file system access APIs
not yet
implemented on all browsers. Any browser based on the Google Chromium
engine supports it.
Example:
// querying the list of files in a folder
procedure TForm1.WebButton1Click(Sender: TObject);
var
Files: TfileSystemFileHandleArray;
i :integer;
begin
Files := await(TFileSystemFileHandleArray, AFolder.OpenFolder());
for i := 0 to Length(Files) - 1 do
begin
WebListBox1.Items.Add(Files[i].Name);
end;
end;
Properties for TWebLocalFolder
Property |
Description |
Files |
Collection of files in the folder |
FolderHandle |
Handle to the currently opened folder |
Methods for TWebLocalFolder
Method |
Description |
OpenFolder: TJSPromise |
Async method to open a folder. Returns the array of files in the folder. |
Open |
Method that opens a folder and triggers the event OnFolderOpen when the files have been asynchronously retrieved |
Open(AOpenFolder: TOpenFolderProc) |
Method that opens a folder and calls the anonymous method parameter when files have been asynchronously retrieved |
CreateFolder(const AName: string): TJSPromise |
Async function creating a folder on the local file system and returning the folder handle |
CreateFile(const AName: string): TJSPromise |
Async function creating a file on the local file system and returning the folder handle |
FileHandle(const AName: string): TJSPromise |
Async function returning the file handle of named file on the local file system |
FileObject(const AName: string): TJSPromise |
Async function returning the file object of named file on the local file system |
Folder(const AName: string): TJSPromise |
Adync function returning the folder handle of named folder on the local file system |
GetFile(AName: string: GetFile: GetFileProc) |
Method that gets the file object of a file in the folder. When the file handle is retrieved, the anonymouse GetFile method is called |
GetFileHandle(AName: string: GetFile: GetFileProc) |
Method that gets the file handle of a file in the folder. When the file handle is retrieved, the anonymouse GetFile method is called |
GetFolder(AName: string; GetFolder: TGetFolderProc) |
Method that retrieves the subfolder of the current active folder and calls the anonymouse GetFolder method asynchronously when ready |
Events for TWebLocalFolder
Event |
Description |
OnFolderOpen |
Event triggered when a folder was opened and the list of files is ready and accessible via the Files array |