Gio.FileInfo

const Gio = imports.gi.Gio;

let fileInfo = new Gio.FileInfo();
  

Functionality for manipulating basic metadata for files. Gio.FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See [GFileAttribute][gio-GFileAttribute for more information on how GIO handles file attributes.

To obtain a Gio.FileInfo for a Gio.File, use Gio.File.prototype.query_info (or its async variant). To obtain a Gio.FileInfo for a file input or output stream, use Gio.FileInputStream.prototype.query_info or Gio.FileOutputStream.prototype.query_info (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the Gio.FileInfo and call Gio.File.prototype.set_attributes_from_info or Gio.File.prototype.set_attributes_async on a GFile.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via Gio.FileInfo.prototype.set_size. You may call Gio.File.prototype.query_settable_attributes and Gio.File.prototype.query_writable_namespaces to discover the settable attributes of a particular file at runtime.

Gio.FileAttributeMatcher allows for searching through a Gio.FileInfo for attributes.

Hierarchy

  • GObject.Object
    • Gio.FileInfo