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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top