.. _object_Resource: :index:`Resource` ----------------- Description *********** The Resource object provides the content of a local or remote file as a string. This can be used to easily process the content of text files or provide base64-encoded image data. :**› Inherits**: :ref:`ByteArray ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 2 * :ref:`error ` * :ref:`errorString ` * :ref:`fileName ` * :ref:`storage ` * :ref:`ByteArray.arrayBuffer ` * :ref:`ByteArray.base64 ` * :ref:`ByteArray.data ` * :ref:`ByteArray.hex ` * :ref:`ByteArray.string ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`ByteArray.remove() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`errorOccurred() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`Error ` Properties ********** .. _property_Resource_error: .. _signal_Resource_errorChanged: .. index:: single: error error +++++ This property holds the most recently occurred error or :ref:`Resource.NoError ` if no error occurred. If the same error occurs multiple times this property does not change. Use the :ref:`errorOccurred() ` signal to detect multiple occurrences of the same error. :**› Type**: :ref:`Error ` :**› Signal**: errorChanged() :**› Attributes**: Readonly .. _property_Resource_errorString: .. _signal_Resource_errorStringChanged: .. index:: single: errorString errorString +++++++++++ This property holds the current human readable error string corresponding to the current value in the :ref:`error ` property. It may include additional information such as failure reasons or locations. :**› Type**: String :**› Signal**: errorStringChanged() :**› Attributes**: Readonly .. _property_Resource_fileName: .. _signal_Resource_fileNameChanged: .. index:: single: fileName fileName ++++++++ This property holds the name of the resource file to read. It can be a full URL (including remote URLs with the http scheme) or a path relative to :ref:`storage ` and its :ref:`path ` on the storage. :**› Type**: String :**› Signal**: fileNameChanged() :**› Attributes**: Writable .. _property_Resource_storage: .. _signal_Resource_storageChanged: .. index:: single: storage storage +++++++ This property holds a reference to the storage which the resource file is stored on. :**› Type**: :ref:`Storage ` :**› Signal**: storageChanged() :**› Attributes**: Writable Signals ******* .. _signal_Resource_errorOccurred: .. index:: single: errorOccurred errorOccurred() +++++++++++++++ This signal is emitted whenever an error has occurred, regardless of whether the :ref:`error ` property has changed or not. In contrast to the change notification signal of the :ref:`error ` property this signal is also emitted several times if a certain error occurs several times in succession. Enumerations ************ .. _enum_Resource_Error: .. index:: single: Error Error +++++ This enumeration describes all errors which can occur in Resource objects. The most recently occurred error is stored in the :ref:`error ` property. .. index:: single: Resource.NoError .. index:: single: Resource.FileNotFoundError .. index:: single: Resource.FileOpenError .. index:: single: Resource.FileTooBigError .. list-table:: :widths: auto :header-rows: 1 * - Name - Value - Description .. _enumitem_Resource_NoError: * - ``Resource.NoError`` - ``0`` - No error occurred or was detected. .. _enumitem_Resource_FileNotFoundError: * - ``Resource.FileNotFoundError`` - ``1`` - Resource file not found. .. _enumitem_Resource_FileOpenError: * - ``Resource.FileOpenError`` - ``2`` - File can't be opened for reading. .. _enumitem_Resource_FileTooBigError: * - ``Resource.FileTooBigError`` - ``3`` - File size exceeds internal limits.