开发者

How to get the file size using Javascript in Chrome extensions?

How can I get the size of file written in a sandboxed sect开发者_JS百科ion of chrome using javascript ?


It is not amazingly easy.

The FileEntry and Entry interface has a method called getMetaData, but this doesn't include the file size. The only way that I could work out how to do it is as follows:

  1. Get the file entry
  2. Call file, to get a reference to the file, the file is of type Blob.
  3. Read blob.size

It means potentially loading the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜