Adds the given file to the end of the response, changing the MIME type by guessing from the file extension what the content is.


The list of file extensions and resulting MIME type can be seen here. The extension check excludes some common formats like MP4. The extension check is case insensitive.


The MIME type is passed in the Content-Type response header.

The character set is also set, to UTF-8, even when the type is not a text type i.e. "Content-Type: text/xxx".

Downloading notes

If the type could not be guessed, it will be set to generic binary, with the UTF-8 charset, i.e. "Content-Type: application/octet-stream; charset=UTF-8".

The filename will not be passed with the download, so the filename of the webpage will be used. If you want to set a filename that differs to that, you can specify the preferred name with the Content-Disposition response header, but unfortunately Lacewing Webserver does not support setting response headers.

So instead, use the application/octet-bytes MIME type, and/or use <a> tag's download attribute. For example, in your webpage:

 <a download="yourfilename.jpg" href…>


Lacewing Webserver can send files that are greater than 4GB, as it uses a 64-bit response size variable.