Function Updated 23 Oct 2026
setMime(mime)
Allows user to set the mime type of a response.
Parameters
mimestringrequiredMime type to return
Returns
An empty string — so it writes nothing when used inside #...# — and sets the Content-Type of the response.
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
docly.setMime("text/css");
write(include("assets/style/file1.css"));
write(include("assets/style/file2.css"));
}#Normal JavaScript, running in the browser or on the Docly™ server.
// This example returns an image file from API function
// Get a document to read embedded file from
let file = docly.getFile("test");
// Read bytes of an embedded file
// Note that file.Image1 contains the filename reference with the correct file extension
let embedded = docly.getEmbeddedFile("test", file.Image1);
// Set headers to make the bytes returned raw
//docly.setContentDisposition("attachment", file.Image1);
//docly.setMime("image/jpeg");
//return embedded;