开发者

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

开发者 https://www.devze.com 2023-02-20 12:07 出处:网络
How can I get the size of file written in a sandboxed sect开发者_JS百科ion of chrome using javascript ?It is not amazingly easy.

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

精彩评论

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