È possibile ottenere i dati grezzi del file che si sta richiedendo, ma non riesco a far sì che il browser serva il file all'utente. Devo usare iframe?Download dei download da lavorare tra angularjs e express.js
//Client code
download_file: function (path, callback) {
$http.post('/download/client_file', {path:path}).
success(function(data, status, headers, config) {
console.log(data); //this contains the raw data of the res.download
//from the server.
});
}
//server code
res.download(file); // the path is proper
Funziona meglio se si esegue un HTTP GET? (alias emulare cosa succederà se l'utente dovesse fare clic su un collegamento al file) –
Non importa se ho usato GET o POST, non avevo proprio un oggetto dati di forma. –