Exemple #1
0
 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);
            }
        }
Exemple #3
0
 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())
     );