const classafBedSheet::FileAsset
sys::Obj afBedSheet::FileAsset
(Response Object) Use in place of a File object 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!
Generally you would acquire FileAssets from the FileHander and PodHander services and use them to embed client URLs in your web pages.
fileHandler.fromLocalUrl(`/images/fanny.jpg`).clientUrl
- clientUrl
const Uri? clientUrlThe URL that clients (e.g. web browsers) should use to access the file resource. The
clientUrlcontains any extraWebModpath 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.
Note: use BedSheetServer should you want an absolute URL that starts with
http://.Returns
nullif file doesn't exist.- etag
const Str? etagThe ETag uniquely identifies the file and its version. The default implementation is a hash of the modified time and the file size.
Returns
nullif file doesn't exist- exists
const Bool existsReturns
trueif the file exists. (Or did at the time this class was created.)- file
const File fileThe file in question
- localUrl
const Uri? localUrlThe URL relative to the
BedSheetWebMod that corresponds to the file resource. If your application is the ROOT WebMod then this will be the same asclientUrl; bar any asset caching. If in doubt, use theclientUrlinstead.Returns
nullif file doesn't exist.- modified
const DateTime? modifiedGet the modified time of the file, floored to 1 second which is the most precision that HTTP can deal with.
Returns
nullif file doesn't exist- size
const Int? sizeThe size of the file in bytes.
Returns
nullif file doesn't exist- toStr
virtual override Str toStr()Returns
clientUrlso this can be printed in HTML, orfile.toStrifclientUrlisnull.