const classafBedSheet::FileAsset
sys::Obj afBedSheet::FileAsset
A wrapper around a File
object used to prevent excessive polling of the file system. As every call to File.exists()
typically takes at least 8ms-12ms, this is probably a good thing!
FileAssets
are acquired from FileHander
and should be used to embed client URLs in your web pages.
- clientUrl
const Uri? clientUrl
The URL that clients should use to access the file resource. The
clientUrl
contains any extraWebMod
path segments required to reach theBedSheet WebMod
. It also contains path segments as provided by any asset caching strategies, such as Cold Feet.Client URLs are designed to be used / embedded in your HTML.
Returns
null
if file doesn't exist- etag
const Str? etag
The ETag uniquely identifies the file and its version. The default implementation is a hash of the modified time and the file size.
Returns
null
if file doesn't exist- exists
const Bool exists
Returns
true
if the file exists. (Or did at the time this class was created.)- file
const File file
The file in question
- localUrl
const Uri? localUrl
The URL relative to the
BedSheet
WebMod that corresponds to the file resource. This may be the same asclientUrl
or it may not. If in doubt, use theclientUrl
instead.Returns
null
if file doesn't exist- modified
const DateTime? modified
Get the modified time of the file, floored to 1 second which is the most precision that HTTP can deal with.
Returns
null
if file doesn't exist- size
const Int? size
The size of the file in bytes.
Returns
null
if file doesn't exist- toStr
virtual override Str toStr()
Returns
clientUrl
so this can be printed in HTML.