Your Search Results


    This article is in need of a technical review.

    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

    This API is available on Firefox OS for privileged or certified applications only.


    The usedSpace method is used to get the total of space used by the storage (the amount of space filled by files).

    The request's result is a number representing the amount of available space expressed in Bytes.


    var instanceOfDOMRequest = instanceOfDeviceStorage.usedSpace();


    It returns a DOMRequest object to handle the success or error of the operation.


    var sdcard = navigator.getDeviceStorage("sdcard");
    var request = sdcard.usedSpace();
    request.onsuccess = function () {
      // The result is expressed in bytes, let's turn it into Gigabytes
      var size = this.result / Math.pow(10,9);
      console.log("The files on your SDCard take " + size.toFixed(2) + "GB of space.");
    request.onerror = function () {
      console.warn("Unable to get the space used by the SDCard: " + this.error);


    Not part of any specification.

    See also

    Document Tags and Contributors

    Contributors to this page: kscarfone, fscholz, Jeremie
    Last updated by: fscholz,