SetMime(mime) Last updated: 28. Jun 2023

Allows user to set the mime type of a response.

Parameters

Name Type Description
mime string Mime type to return

Returns

Null, but sets the mime type header of the output.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    docly.setMime("text/css");
    write(include("assets/style/file1.css"));
    write(include("assets/style/file2.css"));
#}

Code example (JS)

JS is normal JavaScript either 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 witht 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;