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:ByteArray

Properties

error

This property holds the most recently occurred error or Resource.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly

errorString

This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly

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 storage and its path on the storage.

› Type:String
› Signal:fileNameChanged()
› Attributes:Writable

storage

This property holds a reference to the storage which the resource file is stored on.

› Type:Storage
› Signal:storageChanged()
› Attributes:Writable

Signals

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.

Enumerations

Error

This enumeration describes all errors which can occur in Resource objects. The most recently occurred error is stored in the error property.

Name Value Description
Resource.NoError 0 No error occurred or was detected.
Resource.FileNotFoundError 1 Resource file not found.
Resource.FileOpenError 2 File can’t be opened for reading.
Resource.FileTooBigError 3 File size exceeds internal limits.