# Class Storage#downloadFirmware

storage

- Defined in: storage.js

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Storage#downloadFirmware(successCallback, errorCallback, options) Downloads firmware from remote server using 'http' or 'https' protocol.

## Class Detail

Storage#downloadFirmware(successCallback, errorCallback, options)

Downloads firmware from remote server using 'http' or 'https' protocol. Before downloading, check the free storage size of the platform using Storage.getStorageInfo().
Received firmware file will be deleted after upgrade is completed by calling Storage.upgradeFirmware(), which in turn results in monitor reboot.
After reboot, stored firmware file will be deleted even if Storage.upgradeFirmware() was not called, so if wrong firmware file was downloaded, just reboot the monitor without calling Storage.upgradeFirmware() to delete it.

    function downloadFirmware() {
       var successCb = function () {
         console.log("Download firmware is successful");
       };

       var failureCb = function(cbObject) {
         var errorCode = cbObject.errorCode;
         var errorText = cbObject.errorText;
         console.log( " Error Code [" + errorCode + "]: " + errorText);
       };

       var options = {
          uri : "http://example.org/firmware.10-01.00.10_usb_V3_SECURED.epk"
       };

       var storage = new Storage();
       storage.downloadFirmware(successCb, failureCb, options);

    }

Parameters:
{Function} successCallback
  success callback function.
{Function} errorCallback
  failure callback function.
{Object} options

  Property | Type | Description | Required
  --- | --- | --- | ---
  uri | String | URI for the firmware(in http or https) | required

Since:
  1.2
Returns:

  After the method is successfully executed, successCallback is called without any parameter. If an error occurs, errorCallback is called with errorCode and errorText as parameters.

See:
  Storage.upgradeFirmware(), Storage.getFirmwareUpgradeStatus()