Metadata.size

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The read-only size property of the Metadata interface specifies the size, in bytes, of the referenced file or other file system object on disk.

Syntax

var size = Metadata.size;

Value

A number indicating the size of the file in bytes.

Example

This example checks the size of a log file and removes it if it's larger than a megabyte.

workingDirectory.getFile("log/important.log", {}, function(fileEntry) {
  fileEntry.getMetadata(function(metadata) {
    if (metadata.size > 1048576) {
      fileEntry.remove(function() {
        /* log file removed; do something clever here */
      });
    }
  });
}, handleError);

This API has no official W3C or WHATWG specification.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
size
ExperimentalNon-standard
Chrome Full support 13Edge Full support ≤79Firefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support YesFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android Full support Yes

Legend

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.

See also