The UsbStorage object is a Storage object which provides access to a USB drive connected to the local device. Whenever a USB drive is detected by the system, the UsbStorage object mounts it automatically and updates the Storage.available property. When writing files to a USB drive make sure to call eject() before allowing the user to unplug the drive.

› Inherits:Storage



This property holds the most recently occurred error or UsbStorage.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


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



This method writes all pending data to the USB drive and unmounts it so it can be removed safely. After unmounting it’s not accessible any longer until the USB drive is physically plugged in again.

› Returns:Boolean


This method writes all pending data (i.e. write buffers/caches) to the USB drive.



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.



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

Name Value Description
UsbStorage.NoError 0 No error occurred or was detected.
UsbStorage.MountError 1 Error while mounting USB drive ().


import InCore.Foundation 2.5

Application {

    CsvWriter {
        id: csvWriter

        // create fictional measurements
        Repeater on objects {
            model: 3
            Measurement {
                name: "meas" + index
                data: index

        // write one data row to CSV file to USB drive whenever it is plugged in and eject it afterwards
        output: File {
            fileName: "measurements.csv"
            storage: UsbStorage {
                onAvailableChanged: {