On Tuesday, August 29, 2017 at 1:09:02 PM UTC-7, Sergey Litvinov wrote:
could you please help me with the code required to withdraw the file (itself) size?
For security reasons, browsers severely restrict access to file system information. As such, it is not possible to directly read the size of the file stored on disk.
However, there are some ways for getting the size of the *currently loaded* HTML content, by using
document.head.innerHTML.length + document.body.innerHTML.length
or
document.documentElement.innerHTML.length
Note: these values only approximate the actual file size. For example, using Chrome's built-in Developer Tools with a downloaded copy of
http://tiddlywiki.com/empty.html yields the following:
document.head.innerHTML.length + document.body.innerHTML.length
= 1806387
document.documentElement.innerHTML.length
= 1806430
However, the actual file size (as reported by Win10 file "Properties" dialog)
= 1938885
perhaps this is close enough for your purposes?
let me know how it goes...
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals