public WebAsset( string path, WebAssetMetadata metadata, WebAssetContent content ) { Path = path; Metadata = metadata; Content = content; }
string ContentEncodingHeader(WebAssetContent content) { switch (content.Encoding) { case ContentEncoding.Deflate: return("deflate"); case ContentEncoding.GZip: return("gzip"); case ContentEncoding.Raw: default: return(null); } }
public WebAsset WithNewContent(WebAssetContent content) => new WebAsset(Path, Metadata.WithContentLength(null), content);
WebAsset ToWebAsset(string path, IFileInfo fileInfo) => new WebAsset( path, new WebAssetMetadata(fileInfo.Name, fileInfo.Length, fileInfo.LastModified, null), WebAssetContent.FromStream(fileInfo.CreateReadStream()) );