file-download.ais
execute(input)
storage = service "storage_documents"
// The File Input contract supplies a validated finalized media ID.
document = storage.root().get("cdn/" + input.document.id)
if document == null
fail NotFound "Document not found"
end
if not document.isFile()
fail InvalidInput "The document is not a file"
end
return file document with {
filename: input.document.name,
contentType: input.document.contentType
}
end
All examples