7

How might I learn the size of a file located in a local filesystem exposed through the HTML5 API?

I'm expecting something along the lines of,

 fileSystem.root.getFile(path, { create: false }, function (fileEntry) {
       //    fileEntry.size - ????????

        });

...to be available, but haven't found anything like it.

Shog9
  • 156,901
  • 35
  • 231
  • 235
Taron Mehrabyan
  • 2,199
  • 2
  • 20
  • 27

1 Answers1

11

You need to call:

fileEntry.getMetadata(function(metadata) { 
    alert(metadata.size); // or do something more useful with it...
});

See the specifications for the filesystem Entry interface and Metadata interface for details.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340