kony.io.FileList Namespace
FileList namespace represents the list of file objects.
FileList Properties:Name | Description |
---|---|
length: [type: Number, ReadOnly] | Returns the number of files in the FileList object. |
The FileList library comprises of the following API.
Functions
The kony.io.FileList
namespace contains the following functions.

The item API returns the File object at the specified index in the FileList.
Syntax
kony.io.File.item(index);
Input Parameters
Parameter | Description |
---|---|
Index | Index in the FileList. |
Example
var mainLoc = kony.io.FileSystem.getDataDirectoryPath(); var newDirLoc = mainLoc + constants.FILE_PATH_SEPARATOR + "myDirItem"; var myNewDir = new kony.io.File(newDirLoc).createDirectory(); var myFile1Loc = mainLoc + constants.FILE_PATH_SEPARATOR + "myDirItem" + constants.FILE_PATH_SEPARATOR + "myFileItem1.txt"; var myFile1 = new kony.io.File(myFile1Loc).createFile(); var myFile2Loc = mainLoc + constants.FILE_PATH_SEPARATOR + "myDirItem" + constants.FILE_PATH_SEPARATOR + "myFileItem2.txt"; var myFile2 = new kony.io.File(myFile2Loc).createFile(); var myFileTemp = new kony.io.File(newDirLoc); var filesListTemp = myFileTemp.getFilesList(); //getFilesList using getFilesList API alert(filesListTemp.length); //File list length must be greater than 0. var myFile = filesListTemp.item(1); //Provide index of file alert(JSON.stringify(myFile.name));
Return Values
Return Value | Description |
---|---|
File | File object at specified index. Null if there is no File at specified index or if index is not in FileList range. |
Exceptions
None
Platform Availability
- iOS
- Android