How can I retrieve a file's size using the HTML5 FileSystem interface?
Asked Answered
O

1

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.

Opuntia answered 13/11, 2013 at 21:41 Comment(0)
C
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.

Carpometacarpus answered 13/11, 2013 at 21:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.