From fcfa9d48d8cdf061f1eb9a1b8930a2a3e3c521f4 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Thu, 7 Jun 2018 21:31:20 -0400 Subject: [PATCH] file size method for convenience --- cgi.d | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cgi.d b/cgi.d index adc2f41..99b2b56 100644 --- a/cgi.d +++ b/cgi.d @@ -976,7 +976,17 @@ class Cgi { immutable(ubyte)[] content; /// The actual content of the file, if contentInMemory == true string contentFilename; /// the file where we dumped the content, if contentInMemory == false. Note that if you want to keep it, you MUST move the file, since otherwise it is considered garbage when cgi is disposed. + /// + ulong fileSize() { + if(contentInMemory) + return content.length; + import std.file; + return std.file.getSize(contentFilename); + } + + + /// void writeToFile(string filenameToSaveTo) { import std.file; if(contentInMemory)