Downloading attachments programmatically

Is it possible to download an attachment programmatically, not using the display-file component? i.e. just download the file from the DB without showing it in app.

Yea, you can use the journey.files.saveFile function directly from your APP JS/TS (docs here).

Like this:

var object = DB.object.first();
var data = object.attachment.toArrayBuffer(); // turn the attachment into either Base64 string or an ArrayBuffer
var filename = object.attachment.getFilename(); // choose a filename or use the existing one
journey.files.saveFile(data, filename);

Please note this only works on Desktop due to filesystem restrictions on Mobile.