Gio.FileEnumerator
const Gio = imports.gi.Gio;
let fileEnumerator = new Gio.FileEnumerator({
container: value,
});
Gio.FileEnumerator allows you to operate on a set of #GFiles, returning a Gio.FileInfo structure for each file enumerated (e.g. Gio.File.prototype.enumerate_children will return a Gio.FileEnumerator for each of the children within a directory).
To get the next file's information from a Gio.FileEnumerator, use Gio.FileEnumerator.prototype.next_file or its asynchronous version, Gio.FileEnumerator.prototype.next_files_async. Note that the asynchronous version will return a list of #GFileInfos, whereas the synchronous will only return the next file in the enumerator.
The ordering of returned files is unspecified for non-Unix platforms; for more information, see GLib.Dir.prototype.read_name. On Unix, when operating on local files, returned files will be sorted by inode number. Effectively you can assume that the ordering of returned files will be stable between successive calls (and applications) assuming the directory is unchanged.
If your application needs a specific ordering, such as by name or modification time, you will have to implement that in your application code.
To close a Gio.FileEnumerator, use Gio.FileEnumerator.prototype.close, or its asynchronous version, Gio.FileEnumerator.prototype.close_async. Once a Gio.FileEnumerator is closed, no further actions may be performed on it, and it should be freed with GObject.Object.prototype.unref.
Hierarchy
-
GObject.Object
- Gio.FileEnumerator
Methods
- Gio.FileEnumerator.prototype.close
- Gio.FileEnumerator.prototype.close_async
- Gio.FileEnumerator.prototype.close_finish
- Gio.FileEnumerator.prototype.get_child
- Gio.FileEnumerator.prototype.get_container
- Gio.FileEnumerator.prototype.has_pending
- Gio.FileEnumerator.prototype.is_closed
- Gio.FileEnumerator.prototype.next_file
- Gio.FileEnumerator.prototype.next_files_async
- Gio.FileEnumerator.prototype.next_files_finish
- Gio.FileEnumerator.prototype.set_pending