From ab80b79c8f5eebe032e6b625fba53509fe1fa826 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Thu, 1 Dec 2011 13:33:55 -0500 Subject: [PATCH] helper class for returning static files --- web.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web.d b/web.d index a3b7ed1..45a1269 100644 --- a/web.d +++ b/web.d @@ -443,6 +443,23 @@ class ApiObject : WebDotDBaseType { } } +class DataFile : FileResource { + this(string contentType, immutable(void)[] contents) { + _contentType = contentType; + _content = contents; + } + + private string _contentType; + private immutable(void)[] _content; + + string contentType() const { + return _contentType; + } + + immutable(ubyte)[] getData() { + return cast(immutable(ubyte)[]) _content; + } +} /// Describes the info collected about your class struct ReflectionInfo {