I am using BaseX restxq for accessing a repository from a web browser. Uploading files works smoothly, but I can't see how to make a download button work. For uploading, the recipie on the restxq help page was enough to get it to work. Is there a corresponding way for making downloading work? What I have tried is to let BaseX send a html-page containing: <form method="get" action="/download/{$file}"> <button type="submit">Download</button> </form> To process this form is the following restfunction declare %rest:path("/download/{$file}") %output:method("html") function page:download-file($file) { ... } Inside the curly braces, I have tried an <a href..> element and file:read-binary, but none of them with any success. BaseX complains about the <a> element, and file:read-binary outputs directly to the browser. Any suggestions?