最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I retrieve a file's size using the HTML5 FileSystem interface? - Stack Overflow

programmeradmin3浏览0评论

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.

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.

Share Improve this question edited Nov 21, 2013 at 0:14 Shog9 160k36 gold badges235 silver badges240 bronze badges asked Nov 13, 2013 at 21:41 Taron MehrabyanTaron Mehrabyan 2,2293 gold badges21 silver badges27 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论